Build: Fix "ValueError: I/O operation on closed file"
Very occasionally, a build would fail with the above error. The root
cause was that neither of the output streams for a process would be
unregistered from the selector until both had reported EOF. This means
that one of them could be requeued after it reported EOF, while the
second was handled and (and the first unregistered/closed as a result).
Then we would get around to handling the first one from the queue and
bang.
Solve this by unregistering the stream from the selector as soon as it
reports EOF. Acomplish by refactoring _proc_deactivate() into
_proc_stream_deactivate() + _proc_deactivate(). And also simplify some
process shutdown code since popen is doing all the stream close() calls
for us (proven with trace).
Signed-off-by:
Ryan Roberts <ryan.roberts@arm.com>
Loading
Please register or sign in to comment