Updated pipe read to use a timeout (allows script to check for pipe
input and run either way).