-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
I am trying to figure out the correct way to use this library, I use the following test code:
Python 2.7.5 (default, Sep 15 2016, 22:37:39)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> from func_timeout import func_set_timeout
>>>
>>> @func_set_timeout(3)
... def test():
... while True:
... time.sleep(1)
... print "test"
...
>>>
>>> test()
test
test
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/func_timeout/dafunc.py", line 185, in <lambda>
return wraps(func)(lambda *args, **kwargs : func_timeout(defaultTimeout, func, args=args, kwargs=kwargs))
File "/usr/lib/python2.7/site-packages/func_timeout/dafunc.py", line 101, in func_timeout
raise FunctionTimedOut('', timeout, func, args, kwargs)
func_timeout.exceptions.FunctionTimedOut: Function test (args=()) (kwargs={}) timed out after 3.000000 seconds.
>>> test
test
test
test
test
KeyboardInterrupt
>>> test
test
test
test
After the func_timeout.exceptions.FunctionTimedOut, the test function is not terminated, how can i stop the function?
Metadata
Metadata
Assignees
Labels
No labels