purescript-node/purescript-node-child-process

The standard streams problem

Closed this issue · 1 comments

See also joneshf/purescript-node-child-process#4

For each of stdin, stdout, and stderr, the stream will be accessible on the child process object if and only if "pipe" was passed as the relevant stdio options. For example, if you did var child = spawn(cmd, args, { stdio: ["pipe", someStream, "pipe"]}, then you would be able to read child.stderr and write child.stdin, but child.stdout would be null.

Currently, we throw an error if you try to access one of the standard streams after spawning it and passing something other than Pipe for that stream. It might be nice to work out how to do this in a safer way than just failing at runtime, if possible.

As of #46, ChildProcess guarantees that the stdio is always [ pipe, pipe, pipe, ipc ]. However, more control is provided via the Unsafe module if one wants to use something else.