From: Anders W. <And...@ac...> - 2002-08-29 14:47:27
|
I've tried using nohup (from bash), but it doesn't fix the problem. From what I've been able to find, this problem only exists on Solaris. I found a good description of the problem at http://archive.develooper.com/per...@pe.../msg61417.html <http://archive.develooper.com/per...@pe.../msg61417.html> -- this person seems to have tracked the problem down: Please consider the following minimal perl program: perl -MIO::Pty -e'$T=new IO::Pty;print ${*$T}{'io_pty_ttyname'};if(-t $T){print " is a tty\n";}else{print " is no tty\n";}' You would expect it to print "xxx is a tty" in _any_ case. In fact, it does not. IRIX64 6.5 : /dev/ttyq8 is a tty SunOS 5.6 : /dev/pts/11 is no tty Linux 2.2 (Redhat 7.0): /dev/pts/1 is a tty AIX 4.3 : /dev/pts/3 is a tty All of them are Perl 5.6 with current IO::Pty. Tty.xs seems to have to wade through pretty thick muck to implement OpenPTY (which is called by IO::Pty::new()). I guess something in there goes wrong. ************* end original bugreport ******************** This might be good or bad, the problem is that this behavior breaks Expect.pm. An Expect object inherits from IO::Pty. The function Expect::exp_stty() calls both POSIX::isatty() (which fails because its identical to -t) and IO::Stty::stty(). IO::Stty::stty() calls isatty() and a lot of terminal related stuff I don't really understand. Anyhow the first isatty() will kill Expect::exp_stty(). This is the reason I believe this is a bug: It breaks the Expect module. anders -----Original Message----- From: Roland Giersig [mailto:RGi...@cp...] Sent: Thursday, August 29, 2002 1:36 AM To: Anders Wallgren Cc: 'Blackstone, J. David'; Jason Penney; Alexander Bourov; exp...@li... Subject: RE: [Expectperl-discuss] Problem running in bg > It's been a while since I tracked it down, but I seem to remember > that it ran into trouble in IO::Pty::make_slave_controlling_terminal. IO-Tty and Expect now correctly handle the controlling terminal of the spawned process, that is, the spawned process runs in its own process group and gets the slave pty set as its controlling terminal (otherwise Expect wouldn't be able to handle password prompts). But this process group gets into the way of the shells job control. /bin/sh doesn't have job control, that's why the mentioned workaround works. Another way would be to use the utility 'nohup' (don't know, which system it is available on, I have it here on AIX) for putting commands into the background. It also handles the case that the background process would get a SIGHUP if the user logs out of the foregropund shell... Hope this helps, Roland -- RGi...@cp... |