Merge pull request #4 from fumiyas/master

Assorted fixes.
Restore timeout checking logic

Because of this -

mx:~# bash --version
GNU bash, version 3.1.17(1)-release (i486-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

mx:~# read -r -t 1; echo $?
1
Do not check the return code on read timeout for bash 4.0+