Message309115
you'll notice I added an alternate PR. I don't like the complication of adding yet another knob (cleanup_timeout) to subprocesses already giant API surface. It will rarely be used.
My PR tries to take a practical approach: Just wait a little while (arbitrary value of little chosen in the code) for the child after receiving SIGINT before reraising the exception and triggering a .kill() matching existing behavior.
The one controversial thing in my PR (which could be undone, it is independent of the other changes) is that I also modify the context manager __exit__ behavior to not do an infinite wait() upon KeyboardInterrupt. This means context managers of Popen _will_ complete potentially leaving a dangling process around (which our existing __del__ will pick up and put in the internal subprocess._active list). Relatively harmless, but a change none-the-less.
I went that far to try and better match the Python 2.7 and 3.2 behavior: On SIGINT our process sees the KeyboardInterrupt "right away" (not quite as instantaneously here given the wait timeouts, but close enough for interactive command line tool ^C happiness).
It seems like an improvement all around and is IMNSHO less complicated. |
|
Date |
User |
Action |
Args |
2017-12-28 04:08:03 | gregory.p.smith | set | recipients:
+ gregory.p.smith, vstinner, SilentGhost, martin.panter, Mike Pomraning, rpcope1 |
2017-12-28 04:08:03 | gregory.p.smith | set | messageid: <1514434083.36.0.213398074469.issue25942@psf.upfronthosting.co.za> |
2017-12-28 04:08:03 | gregory.p.smith | link | issue25942 messages |
2017-12-28 04:08:01 | gregory.p.smith | create | |
|