Subject: | expect dies as result of window resize |
Following the example in the POD, resizing of the parent window causes the script to die.
Use of uninitialized value in sysopen at /usr/lib/perl5/5.8.0/i586-linux-thread-multi/IO/File.pm line 159.
Use of uninitialized value in concatenation (.) or string at
/usr/lib/perl5/site_perl/5.8.0/i586-linux-thread-multi/IO/Pty.pm line 76.
Cannot open slave: No such file or directory at /home/jwing/bin/essh line 151
The failure appears to be related to IO::Pty. The following line does not return a tty value:
my $tty = $master->ttyname();
A simple test of the expect new subroutine appears to show that the Pty is lost following the bless:
New Function w/ prints:
sub new {
my ($class) = shift;
$class = ref($class) if ref($class); # so we can be called as $exp->new()
# Create the pty which we will use to pass process info.
my($self) = new IO::Pty;
die "$class: Could not assign a pty" unless $self;
print "tty: ",$self->ttyname(),"\n";
bless $self => $class;
print "tty: ",$self->ttyname(),"\n";
$self->autoflush(1);
# This is defined here since the default is different for
# initialized handles as opposed to spawned processes.
${*$self}{exp_Log_Stdout} = 1;
$self->_init_vars();
if (@_) {
# we got add'l parms, so pass them to spawn
return $self->spawn(@_);
}
return $self;
}
Simple test script:
#!/usr/bin/perl
use Expect;
$pty = new Expect;
Execution:
tty: /dev/pts/2
tty: