Replace NSStream with NSFileHandle for implementing pipe functionality
This seem to work.