Thorsten Glaser <tg@xxxxxxxxxx> writes: > $ script -qc './test.sh -v' </dev/null 2>&1 | tee log For me, this doesn't hang, but it does exit before test.sh is actually finished. Here's a simpler example that does the same thing: $ cat simpler.sh #!/bin/sh echo one sleep 2 echo two $ script -c './simpler.sh' Script started, file is typescript one two Script done, file is typescript $ script -c './simpler.sh' </dev/null Script started, file is typescript one Script done, file is typescript The "wait for children" code at the end of doinput looks suspicious to me -- finish() doesn't actually block, as the comment implies, just checks to see if any children have finished. Running Thorsten's command under strace -f reveals: [21180 is the script process running doinput, 21181 is running dooutput] 21180 write(4, "\x04", 1 <unfinished ...> 21180 <... write resumed> ) = 1 21180 poll([{fd=4, events=POLLIN}], 1, 100 <unfinished ...> 21180 <... poll resumed> ) = 1 ([{fd=4, revents=POLLIN}]) 21180 poll([{fd=4, events=POLLIN}], 1, 100) = 1 ([{fd=4, revents=POLLIN}]) 21180 poll([{fd=4, events=POLLIN}], 1, 100) = 1 ([{fd=4, revents=POLLIN}]) 21180 poll([{fd=4, events=POLLIN}], 1, 100 <unfinished ...> [lots more poll calls while other stuff happens in child processes] 21180 <... poll resumed> ) = 0 (Timeout) 21180 wait4(-1, 0x7fff47830c54, WNOHANG, NULL) = 0 21180 kill(21181, SIGTERM) = 0 But at this point the child is still running. So it looks like doinput isn't waiting for the child to exit correctly, when stdin has hit EOF before the child has finished. Thanks, -- Adam Sampson <ats@xxxxxxxxx> <http://offog.org/> -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html