This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Joan Prat Rigol
Recipients Joan Prat Rigol
Date 2020-07-22.08:42:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1595407379.06.0.696065311763.issue41367@roundup.psfhosted.org>
In-reply-to
Content
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?
History
Date User Action Args
2020-07-22 08:42:59Joan Prat Rigolsetrecipients: + Joan Prat Rigol
2020-07-22 08:42:59Joan Prat Rigolsetmessageid: <1595407379.06.0.696065311763.issue41367@roundup.psfhosted.org>
2020-07-22 08:42:59Joan Prat Rigollinkissue41367 messages
2020-07-22 08:42:58Joan Prat Rigolcreate