pnpnpn / timeout-decorator

Timeout decorator for Python
MIT License
628 stars 94 forks source link

Doesn't work in Windows #1

Closed mohanraj-r closed 11 years ago

mohanraj-r commented 11 years ago

Thank you for this work.

Is this expected to work in Windows ? I got the following error

----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
    self.test(*self.arg)
  File "c:\Python27\lib\site-packages\timeout_decorator\timeout_decorator.py", line 32, in new_f
    old = signal.signal(signal.SIGALRM, handler)
AttributeError: 'module' object has no attribute 'SIGALRM'

I guess signal module in Windows doesn't have the SIGALRM

It would be helpful if you can edit the Readme and/or put a os check in the code.

Thanks,

pnpnpn commented 11 years ago

I never tested it on Windows. I guess it won't work there. Do you know if there is a work around? If so, I can add you as a collaborator.

Thanks.

mohanraj-r commented 11 years ago

I don't have a workaround for now. And from the brief time I spent searching for solutions, my impression is that it is not possible or easy. If I come upon a workaround, I will contact you.

Thanks,

pombredanne commented 7 years ago

If this can help, check this: https://github.com/nexB/scancode-toolkit/blob/c4b1e9d7da546cf252a01f6fe42c16631df7e630/src/scancode/interrupt.py

It runs on linux/mac/windows thanks to this: https://github.com/nexB/scancode-toolkit/tree/c4b1e9d7da546cf252a01f6fe42c16631df7e630/src/scancode/timeouts

... borrowed from https://github.com/robotframework/robotframework by @pekkaklarck and @mkorpela

Actually https://github.com/robotframework/robotframework/tree/dc0581a46c5da6f632c7e505fafa22046a84ba3a/src/robot/running/timeouts also supports Jython and IronPython.