use nonblocking fgets instead of fork in cmd_extscript