I'd like to propose the attached extension to octave. This implements a new function exec_with_pipes, which creates communication pipes and start a child process. The initial goal is to work around the fact that MSVC/MinGW is missing fork(), such that popen2 is not working (note that MSVC also misses POSIX pipe; it has a "_pipe" function, but with additional arguments).
I only implemented the Win32 version, but UNIX implementation should be straightforward.