Refactor to use dispatch_io for tasks, and wait for EOF

Hopefully resolves #139 and #135.

/cc @joshaber @keithduncan
Is there a problem with the use of `NSPipe`, though? Using `pipe` seems like unnecessary complexity when this should work fine.