Skip to content

Commit

Permalink
Assert proc.stdin and proc.stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
deveshks committed May 26, 2020
1 parent 28cd824 commit a847dda
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/pip/_internal/utils/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,9 @@ def call_subprocess(
stderr=subprocess.STDOUT, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, cwd=cwd, env=env,
)
if proc.stdin:
proc.stdin.close()
assert proc.stdin
assert proc.stdout
proc.stdin.close()
except Exception as exc:
if log_failed_cmd:
subprocess_logger.critical(
Expand All @@ -196,9 +197,7 @@ def call_subprocess(
all_output = []
while True:
# The "line" value is a unicode string in Python 2.
line = None
if proc.stdout:
line = console_to_str(proc.stdout.readline())
line = console_to_str(proc.stdout.readline())
if not line:
break
line = line.rstrip()
Expand Down

0 comments on commit a847dda

Please sign in to comment.