title: Forking a piped sub processes
body: <p>What is the best technique to fork a pipe-lined sub processes?</p>
  
  <p>My current program needs to run another processes that is actually a couple of commands linked by pipes. I do not need to know the output of the commands just if they fail or succeed so I am using fork/exec.</p>
  
  <p>The equivalent on the command line would be</p>
  
  <pre><code> /path/to/A arg1 arg2 | /path/to/B argB1 | /path/to/C
  </code></pre>
  
  <p>Note: Using a script is not practical as it A/B/C may change in the future.</p>
  
  <p>The two techniques I though of are:</p>
  
  <ol>
  <li><p>Recursive fork. Connect the parent (input to its parent) output available for child in next fork.</p></li>
  <li><p>Create all pipes at top level.<br>
  Then use a loop to fork all children that can then connect the pipes appropriately.</p></li>
  </ol>