-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_subprocess: Fix pip install
log window not showing
#567
Conversation
* Fixed an issue where the log window that we use to display `pip-audit`'s | ||
dependency resolution progress was not showing anything | ||
([#567](https://github.com/pypa/pip-audit/pull/567)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs relocating under [Unreleased]
🙂
# NOTE(alex): For reasons I'm unsure about, reading the stderr stream in | ||
# real time seems to interfere with stdout and cause us to read nothing. | ||
# Let's wait until the process is terminated before reading stderr. | ||
stderr = process.stderr.read() # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'm a little worried this might cause deadlocks in some (unlikely) conditions: I can imagine a case where pip
writes to stderr
before stdout
and blocks waiting for the parent's corresponding read, meaning that process.poll()
never sees a process termination (and stdout.read(bufsize)
always results in an empty read).
Specifically, that should only happen if pip
writes enough to stderr
to saturate the underlying pipe buffer. But that might happen, so it's probably worth root causing what's going on here instead of deferring the stderr
read.
This code is going to be reworked as part of #574 so let's see if that fixes it. |
Related to #536. I noticed this when debugging something else. For some reason, when we read
stderr
in the polling loop, it causes us to read nothing forstdout
. There's no reason that we need to readstderr
in the loop since it's not getting dumped into the log window so I just moved this code out of the loop.