Comment by jepler

4 years ago

I think this turns out to be a tangent, but at least superficially it is possible for a C program to "do" shell pipelines without use of fork or vfork (directly) but rather by posix_spawn. I suppose "portable go" does not directly wrap posix_spawn so this option may not be on the table for you.

Basics: https://gist.github.com/ec8469273c7808d46c7285cd056d0104

Typical use: `./a.out seq 3 2 9 -- cat -n` is similar to `seq 3 2 9 | cat -n` except that the return value is nonzero if either side's return value is nonzero.

that said, I wouldn't be surprised if there's something important I'm overlooking here.