RFC: More flexible pipe API

@piscisaureus As discussed on IRC and outlined in https://gist.github.com/2879135 and https://gist.github.com/2879181 this makes the pipe API more flexible by giving explicit control over both pipe ends. 
I did the windows side of this first as I figured that would be the more challenging of the two implementations and would thus reveal any issues. 
Feel like this logic could be simplified.