Closed dennisvang closed 2 years ago
Thanks! Also nice to have the extra test to avoid regressions.
Is there a particular reason for adding this close()
at the end instead of put it where the other pipes are closed?
I will leave this review to you @almarklein . I still haven't found any time to look through the imageio-ffmpeg
codebase, so I don't feel confident doing reviews for this project yet.
(It will have to wait until after the imageio v3 docs are written and I've implemented the metadata API.)
Is there a particular reason for adding this
close()
at the end instead of put it where the other pipes are closed?
@almarklein Yes there is: I also tried closing stderr
right after stdin
(here), but that caused a Windows fatal exception: access violation
during tests in test_io.py
. Not quite sure why...
I played around a bit:
p.stderr.close()
and then all tests pass except the newly added.close()
upwards where the other pipes are closed, even surrounding it with a try-except: segfaults on most builds.It looks like there is no safe way to close the err pipe. I would also think that we don't need to, because the subprocess it is attached to is closed one way or another. Maybe we need to suppress the warning instead?
@almarklein Stopping the log_catcher
before closing stderr
prevents the access violation
I was seeing on windows. I guess that would make sense, as the log_catcher
was probably trying to read from the closed stderr
pipe.
@almarklein I'm just wondering: should the log_catcher
be stopped at the start of the finally
block, i.e. before the if p.poll() is None
?
Oh nice catch! And it seems to work :)
Yes, I think it makes sense to stop the log_catcher
at the start of the finally block, since there is no need for it any more.
Awesome, thanks for this!
This should fix issue #61.
My initial inclination was to call
p.stderr.close()
directly after closingstdout
andstdin
, here. However, that causedWindows fatal exception: access violation
intest_io.py
.