From: Ken I. <fn...@ua...> - 2006-07-12 20:27:57
|
I'm flailing with an error message that occurs following the interact() method: handle id(4) is not a tty. Not changing mode at /usr/share/perl5/Expect.pm line 376, <> line 1. This message is repeated 2 times (i.e., 3 times total), and the script dies. I'm not sure what handle id(4) refers to; presumably 0-2 are stdin-stderr, 3 seems to be the spawned command pty output, so maybe 4 is the pty input? Oddly, after removing a bunch of i/o to the spawned command the system seems to interact properly, so I'm not sure how to cull this down to demo the problem. My system: perl v5.8.8 built for i486-linux-gnu-thread-multi debian unstable Linux hayes 2.6.16-2-686 #2 Mon May 22 23:10:59 UTC 2006 i686 GNU/Linux debian package libexpect-perl 1.15-4 $ for m in Expect IO IO::Tty IO::Pty IO::Stty; do \ perl -M${m} -e "print qq($m v\$${m}::VERSION\n)"; done Expect v1.15 IO v1.22 IO::Tty v1.02 IO::Pty v1.02 IO::Stty v.02 I thought maybe the trouble was due to aterm, but xterm does the same. My system does use Unix98 ptys, and otherwise seems fine. The error seems to come from a call to POSIX::istty()... I changed from interact() to $exp->interact(\*STDIN, 'BAIL!'), and the error message is now STDIN is not a tty. Not changing mode ... I somehow had the thing run correctly a time or two, but am back to the failure message. Any idea where I'm going wrong? -- Ken Irving, fn...@ua... |
From: Ken I. <fn...@ua...> - 2006-07-13 08:16:25
|
On Wed, Jul 12, 2006 at 12:27:44PM -0800, Ken Irving wrote: > I'm flailing with an error message that occurs following the interact() > method: > ... I guess it's a warning, showing up due to the -w flag: $ perl -MExpect -w -e 'Expect->new()->interact();' < /dev/null handle id(5) is not a tty. Not changing mode at /usr/share/perl5/Expect.pm line 376. handle id(5) is not a tty. Not changing mode at /usr/share/perl5/Expect.pm line 376. handle id(5) is not a tty. Not changing mode at /usr/share/perl5/Expect.pm line 376. but not without it. -- Ken Irving, fn...@ua... |
From: Austin S. <te...@of...> - 2006-07-13 17:51:12
|
On Thu, Jul 13, 2006 at 12:16:10AM -0800, Ken Irving wrote: > On Wed, Jul 12, 2006 at 12:27:44PM -0800, Ken Irving wrote: > > I'm flailing with an error message that occurs following the interact() > > method: > > ... > > I guess it's a warning, showing up due to the -w flag: > > $ perl -MExpect -w -e 'Expect->new()->interact();' < /dev/null > handle id(5) is not a tty. Not changing mode at /usr/share/perl5/Expect.pm line 376. > handle id(5) is not a tty. Not changing mode at /usr/share/perl5/Expect.pm line 376. > handle id(5) is not a tty. Not changing mode at /usr/share/perl5/Expect.pm line 376. > > but not without it. > iirc (and this has been several years) it's necessary to make sure ttys aren't echoing at each other when they interact, thus by default the echoing mode is changed when this occurs. This obviously won't work if you throw something other than a tty at it. It's probably safe to just turn warnings off around that block if the code is otherwise working. It's probably a reasonable warning to have. There may be cases where you expect to be working with a tty but aren't (script called from cron, etc.). Austin |
From: Ken I. <fn...@ua...> - 2006-07-13 20:15:37
|
On Thu, Jul 13, 2006 at 10:52:46AM -0700, Austin Schutz wrote: > On Thu, Jul 13, 2006 at 12:16:10AM -0800, Ken Irving wrote: > > On Wed, Jul 12, 2006 at 12:27:44PM -0800, Ken Irving wrote: > > > I'm flailing with an error message that occurs following the interact() > > > method: > > > ... > > > > I guess it's a warning, showing up due to the -w flag: > > > > $ perl -MExpect -w -e 'Expect->new()->interact();' < /dev/null > > handle id(5) is not a tty. Not changing mode at /usr/share/perl5/Expect.pm line 376. > > handle id(5) is not a tty. Not changing mode at /usr/share/perl5/Expect.pm line 376. > > handle id(5) is not a tty. Not changing mode at /usr/share/perl5/Expect.pm line 376. > > > > but not without it. > > > > iirc (and this has been several years) it's necessary to make sure > ttys aren't echoing at each other when they interact, thus by default the > echoing mode is changed when this occurs. This obviously won't work if you > throw something other than a tty at it. > It's probably safe to just turn warnings off around that block if the > code is otherwise working. It's probably a reasonable warning to have. There > may be cases where you expect to be working with a tty but aren't (script > called from cron, etc.). I can do that, but I get the same warnings even if I run the above command from a tty, or at least from a linux console, in addition to an xterm. Presumably there's something else that needs to be done, but I don't know what it is. Is the message meaningful? Thanks, Ken -- Ken Irving, fn...@ua... |
From: Austin S. <te...@of...> - 2006-07-13 21:59:41
|
> > called from cron, etc.). > > I can do that, but I get the same warnings even if I run the above command > from a tty, or at least from a linux console, in addition to an xterm. > Presumably there's something else that needs to be done, but I don't know > what it is. Is the message meaningful? > The message means you are interacting with something other than a tty. That can often be a surprise. If you want to avoid the message you can either shut off warnings or set $expect->manual_stty(1) which will notify expect not to play with the tty settings during interact(). Austin |
From: Roland G. <RGi...@cp...> - 2006-07-14 09:15:07
|
> $ perl -MExpect -w -e 'Expect->new()->interact();' < /dev/null > handle id(5) is not a tty. Not changing mode at /usr/share/perl5/Expect.pm line 376. > handle id(5) is not a tty. Not changing mode at /usr/share/perl5/Expect.pm line 376. > handle id(5) is not a tty. Not changing mode at /usr/share/perl5/Expect.pm line 376. Well, it's rather clear why you get the warning here, because STDIN is /dev/null (which clearly is not a tty). Could you please post the relevant source code, how you set up that interact() call? Also, there are some systems where the master pty is not a tty (solaris and hp-ux), which would also result in that warning. Cheers, Roland -- RGi...@cp... |