I had to completely change the architecture as Windows does not allow you to close all file descriptions *except* the redirected stdin/stdout/stderr of the child. This means file descriptors were leaking into children, which with long lived children in a web application gives problems. Now the child is executed indirectly via a stub program.
I had to completely change the architecture as Windows does not allow you to
close all file descriptions *except* the redirected stdin/stdout/stderr of the
child. This means file descriptors were leaking into children, which with long
lived children in a web application gives problems. Now the child is executed
indirectly via a stub program.

geertj/winpexpect