Open mdales opened 3 days ago
Thanks for reporting it. You're right! I broke this when fixed SpartanJ/ecode#61 with these changes. I'm still not completely sure what it was the logic behind these changes. I pushed a change that will close the file descriptors and works on macOS (and should work fine on all posix OSes), but I still will need to verify I did not break anything on the Windows build since the fix that broke this was for a Windows specific problem.
Whilst debugging #83 I looked first to see if the pipe file descriptors were being closed, which isn't the case. However, the parent does leak file descriptors, as the parent side FDs are only closed on a call to
subprocess_destroy
, not insubprocess_join
. This makes sense: on wait/join there may be some last data written to stdout/stderr by the child, so that still needs read.Looking at the code I'd suggest the destructor for Process should call
subprocess_destroy
. I need to test that though, which is why this is an issue rather than a PR.