PTs could self-shutdown when they detect their stdout is closed
In [ticket:9330] we were exploring solutions to signal a PT to do clean shutdown on Windows. In [ticket:10006] dcf suggested a workaround using JobObjects, which has the nice property that the children shutdown even when their parent crashes or is killed (SIGKILL or TerminateProcess).
This raises the valid point, why don't we try to achieve this for all platforms? Since all PTs must already communicate via stdout back to Tor (or any parent process, such as a PT chainer), one way of detecting parent death is to check that stdout is still open.
We'll need to research whether we must write to the stream to detect it's closed, or if we can get away with doing something like poll or select.