I\'m looking to call a subprocess with a file descriptor opened to a given pipe such that the open() call does not hang waiting for the other side of the pipe to receive a c
Opening the FD read/write rather than read-only when setting up the pipeline prevents blocking.
To be a bit more specific:
$ mkfifo /tmp/foobar.pipe
$ some_program --command-fd=5 5<>/tmp/foobar.pipe
prevents the undesired blocking behavior, as 5<>/tmp/foobar.pipe opens in RW mode (as opposed to opening in read-only mode as with 5) although O_NONBLOCK is still set. Thanks to waldner on irc://irc.freenode.org/#bash for this pointer.