Don't let subprocesses hang trying to read from stdin
Refactor to use inbuilt shellutils