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 macdjord
Recipients macdjord
Date 2021-03-08.05:41:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1615182106.34.0.569482281722.issue43431@roundup.psfhosted.org>
In-reply-to
Content
Passing the argument `text=True` to `subprocess.run()` is supposed to mean that any captured output of the called process is automatically decoded and retuned to the user as test instead of bytes.

However, if you give a timeout and that timeout expires, the raised `subprocess.TimeoutExpired` exception will have the captured output as as bytes even if text mode is enabled.

Test output:
bash-5.0$ python3 test_subprocess.py
Version and interpreter information: namespace(_multiarch='x86_64-linux-gnu', cache_tag='cpython-37', hexversion=50792432, name='cpython', version=sys.version_info(major=3, minor=7, micro=7, releaselevel='final', serial=0))
Completed STDOUT Type: <class 'str'>
Completed STDOUT Content: 'Start\nDone\n'
Timeout STDOUT Type: <class 'bytes'>
Timeout STDOUT Content: b'Start\n'
History
Date User Action Args
2021-03-08 05:41:46macdjordsetrecipients: + macdjord
2021-03-08 05:41:46macdjordsetmessageid: <1615182106.34.0.569482281722.issue43431@roundup.psfhosted.org>
2021-03-08 05:41:46macdjordlinkissue43431 messages
2021-03-08 05:41:45macdjordcreate