On Jan 7, 3:23 pm, "Martin v. Löwis" <mar...@v.loewis.de> wrote: > > Thanks for the responses. What I mean is when a python process is > > interrupted and does not get a chance to clean everything up then what > > is a good way to do so? For instance, I have a script that uses child > > ptys to facilitate ssh connections (I'm using pxssh). When I ^C the > > python process I am left with the child processes running and the ssh > > connections open. Naturally I run out of ttys if this happens too > > much, which I have had happen. So if python does not get a chance to > > take care of those, what is a good way to do so? Does a try/finally > > or a with statement address that? Thanks! > > That's strange. When the parent process terminates, the tty master > should get closed, causing the slave to be closed as well, in addition > to sending a SIGHUP signal to the child, which ssh should interpret > as terminating. > > Perhaps the problem is that the master socket *doesn't* get closed? > I see that pexpect closes all file descriptors in the child before > invoking exec. Could it be that you are starting addition child > processes which inherit the master socket? > > Regards, > Martin
Thanks. I'll look into that. -eric -- http://mail.python.org/mailman/listinfo/python-list