Fix the blocking bug.

I use nonblocking select to poll stdin and stdout of the underlying
process.