sindresorhus / grunt-shell

Run shell commands
MIT License
949 stars 126 forks source link

fix hangs with CLI commands waiting for input #115

Closed silverwind closed 7 years ago

silverwind commented 7 years ago

The previous .resume() and .pipe() did not close the stdin stream on the child process which made scripts that wait for data on stdin hang. The fix manually sends all stdin chunks to the child and ensures that the stream is always closed afterwards.

There might be a cleaner solution using flowing mode, but I'm not sure how to ensure closure of the target WriteStream when using .pipe().

This should properly solve these issue:

silverwind commented 7 years ago

Actually, there seems to be an issue when sending big amounts of data on stdin, investigating.

silverwind commented 7 years ago

I have to rethink this. I'm pretty certain the issue could be fixed on get-stdin's side too, but hopefully not with a timeout like in https://github.com/sindresorhus/get-stdin/pull/19.