You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use a timeout to kill a subprocess launched via .run(timeout=); this is not supported unlike the original subprocess.run()
To reproduce:
Python 3.8.12 (default, Oct 27 2021, 12:52:48)
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from subprocess_tee import run
>>> run('sleep 10', shell=True, timeout=.1, capture_output=True)
CompletedProcess(args='sleep 10', returncode=0, stdout='', stderr='')
Whereas with subprocess.run the exception is correctly thrown:
Python 3.8.12 (default, Oct 27 2021, 12:52:48)
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from subprocess import run
>>> run('sleep 10', shell=True, timeout=.1, capture_output=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/subprocess.py", line 495, in run
stdout, stderr = process.communicate(input, timeout=timeout)
File "/usr/local/lib/python3.8/subprocess.py", line 1028, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "/usr/local/lib/python3.8/subprocess.py", line 1869, in _communicate
self._check_timeout(endtime, orig_timeout, stdout, stderr)
File "/usr/local/lib/python3.8/subprocess.py", line 1072, in _check_timeout
raise TimeoutExpired(
subprocess.TimeoutExpired: Command 'sleep 10' timed out after 0.1 seconds
I am trying to use a timeout to kill a subprocess launched via .run(timeout=); this is not supported unlike the original subprocess.run()
To reproduce:
Whereas with subprocess.run the exception is correctly thrown:
The output should have been a TimedoutException.
Also tried
The text was updated successfully, but these errors were encountered: