fix Input/output error in run_cmd
keep exiting and reading timing window small