Skip to content

Commit

Permalink
Fix pipe reading hanging indefinitely on Windows (#756)
Browse files Browse the repository at this point in the history
* 🐛 fix pipe reading hanging indefinitely

* ⏪ re-set bufsize to 0

---------

Co-authored-by: Mathieu <923463-mathbou@users.noreply.gitlab.com>
Co-authored-by: William Woodruff <william@yossarian.net>
  • Loading branch information
3 people committed Apr 12, 2024
1 parent bebc8b8 commit 3f52615
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pip_audit/_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ def run(args: Sequence[str], *, log_stdout: bool = False, state: AuditState = Au
# once `stdout` hits EOF, so we don't have to worry about that blocking.
while not terminated:
terminated = process.poll() is not None
# NOTE(ww): Buffer size chosen arbitrarily here and below.
stdout += process.stdout.read(4096) # type: ignore
stderr += process.stderr.read(4096) # type: ignore
stdout += process.stdout.read() # type: ignore
stderr += process.stderr.read() # type: ignore
state.update_state(
f"Running {pretty_args}",
stdout.decode(errors="replace") if log_stdout else None,
Expand Down

0 comments on commit 3f52615

Please sign in to comment.