[New-bugs-announce] [issue41367] Popen Timeout raised on 3.6 but not on 3.8
Joan Prat Rigol
report at bugs.python.org
Wed Jul 22 04:42:59 EDT 2020
New submission from Joan Prat Rigol <pratjunior at gmail.com>:
If I run this code in Python 3.8 I get the result as expected:
Python 3.8.2 (default, Apr 27 2020, 15:53:34)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> process = subprocess.Popen("sudo -Si ls -l /home", shell=True, stdin=-1, stdout=-1, stderr=-1)
>>> out, err = process.communicate(input="Pr4tR1g01J04n\n".encode(), timeout=2)
>>> print(out)
b'total 4\ndrwxr-xr-x 43 joan joan 4096 Jul 22 09:46 joan\n'
>>>
But If I run the code in Python 3.6 I am getting a timeout:
Python 3.6.9 (default, Apr 18 2020, 01:56:04)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> process = subprocess.Popen("sudo -Si ls -l /home", shell=True, stdin=-1, stdout=-1, stderr=-1)
>>> out, err = process.communicate(input="Pr4tR1g01J04n\n".encode(), timeout=2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.6/subprocess.py", line 863, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "/usr/lib/python3.6/subprocess.py", line 1535, in _communicate
self._check_timeout(endtime, orig_timeout)
File "/usr/lib/python3.6/subprocess.py", line 891, in _check_timeout
raise TimeoutExpired(self.args, orig_timeout)
subprocess.TimeoutExpired: Command 'sudo -Si ls -l /home' timed out after 2 seconds
>>>
Is this a bug?
----------
messages: 374089
nosy: Joan Prat Rigol
priority: normal
severity: normal
status: open
title: Popen Timeout raised on 3.6 but not on 3.8
versions: Python 3.6, Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41367>
_______________________________________
More information about the New-bugs-announce
mailing list