Lest I forget: the master fd created here: https://github.com/nodejs/node/blob/20d099af7a1fc103ecfb9a4afe59fd2fdcbe7802/tools/test.py#L723 Is leaked to the spawned child here: https://github.com/nodejs/node/blob/20d099af7a1fc103ecfb9a4afe59fd2fdcbe7802/tools/test.py#L761-L772 Fix: the `preexec_fn` should `os.close(pty_out)`.