On Sat, Mar 19, 2005, Beni Cherniavsky wrote about "Re: ssh logout hang": > I'm not sure from the above description how can a subprocess > still use the terminal after the shell exits - perhaps a foreground job > that catches/ignores SIGHUP. I do think that I saw programs printing > something after the shell has exited.
A child process of the shell can definitely continue to output to the terminal after the shell exited. Try this: run "sh" to get a new shell, and in it run the following commands in sequence (trap '' 1; sleep 20; echo hello)& disown %1 # ignore errors if this doesn't work exit The "exit" exits the shell, but after 20 seconds, you'll see "hello" printed :) By the way, in the code above, "trap '' 1" ignores the SIGHUP (1) signal, and "disown" is needed in some shells to tell them not to kill a background process. In the original Unix implementation, not only could a process continue to generate output long after the shell that created it was gone, but this process would continue to write to the same "tty" device, which often meant that some other innocent user that logged on got your output to his display :) This was eventually fixed, so that when a new tty device is assigned, it cannot have any old processes still using it. I haven't followed the details on how this was done - I assume that the trick is simply to refrain from "recycling" the same tty "device" (which isn't really a device, but rather a kernel entry like /dev/tty* or /dev/pts/*) until nobody has it open. -- Nadav Har'El | Sunday, Mar 20 2005, 9 Adar II 5765 [EMAIL PROTECTED] |----------------------------------------- Phone +972-523-790466, ICQ 13349191 |"Computers are useless. They can only http://nadav.harel.org.il |give you answers." -- Pablo Picasso ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]