Hello,
I am trying to use perl/expect to handle the login to a host (supply
password upon request). After login, the script executes interact such
that I can then use the session. The problem I run into is that an
resize of the window fails. I'd really appreciate any help in figuring
this out. This is the basis for enabling a long line of ssh sess
TIA,
John
Here's the pertinent code:
$e = new Expect;
$e->slave->clone_winsize_from(\*STDIN);
$SIG{WINCH} = \&winch;
sub winch {
$e->slave->clone_winsize_from(\*STDIN);
kill WINCH => $e->pid if $e->pid;
$SIG{WINCH} = \&winch;
}
$Expect::Do_Soft_Close =0;
$e->spawn ("ssh myhost\r");
$match = $e->expect (60, "password:");
if (!defined $match) {
die "Failed to find password prompt at login_dmz".$e->before();
}
$e->send("$VALS{dmzpwd}\r");
$e->expect (30, "-re", "[\>\$\#%] *");
$e->interact();
And here is what I get when I run an stty -a and then later follow it up
with a resizing:
myhost$ stty -a
speed 38400 baud; 24 rows; 80 columns;
eucw 1:1:0:0, scrw 1:1:0:0:
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ^@
eol2 = ^@; start = ^Q; stop = ^S; susp = ^Z; dsusp = ^Y; reprint = ^R
discard = ^O; werase = ^W; lnext = ^V
-parenb -parodd cs8 -cstopb -hupcl cread -clocal -parext
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -iuclc
ixon -ixany -ixoff -imaxbel
isig icanon -xcase echo echoe echok -echonl -noflsh
-tostop echoctl -echoprt echoke -flusho -pending iexten
opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel tab3
myhost$
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 75.
Cannot open slave : No such file or directory at /home/jwing/bin/e line 151
|