[Review] SF-0007: Introducing Swift Subprocess

Process's standardInput is the current process's stdin by default. So your 'parent process' is waiting for you to type something.

This highlights a hazard of Process - that it defaults to using the current process's standard I/Os, which I find very unintuitive and likely to cause exactly these sorts of errors.

You need to explicitly create a Pipe instance and assign it to the relevant channels on Process (before invoking run), for any through which want to communicate with the subprocess. You'll then want to read from the standardOutput pipe inside the parent, not standardInput.

It might be worth considering more helpful names for these in their Subprocess incarnation. childInput / childOutput / childError, perhaps?

1 Like