mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
bpo-43423 Fix IndexError in subprocess _communicate function (GH-24777)
Check to make sure stdout and stderr are not empty before selecting an item from them in Windows subprocess._communicate.
Co-authored-by: Gregory P. Smith <greg@krypto.org>
(cherry picked from commit b4fc44bb2d
)
Co-authored-by: Chris Griffith <chris@cdgriffith.com>
This commit is contained in:
parent
531f2ebd60
commit
ad83fde754
2 changed files with 4 additions and 4 deletions
|
@ -1525,10 +1525,8 @@ class Popen(object):
|
|||
self.stderr.close()
|
||||
|
||||
# All data exchanged. Translate lists into strings.
|
||||
if stdout is not None:
|
||||
stdout = stdout[0]
|
||||
if stderr is not None:
|
||||
stderr = stderr[0]
|
||||
stdout = stdout[0] if stdout else None
|
||||
stderr = stderr[0] if stderr else None
|
||||
|
||||
return (stdout, stderr)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue