in reply to Expect.pm early termination?
Adding this to any perl expect script that is having these same issues should do the trick. I have contacted the author of the Expect module and requested that he add explicit setting of the terminal window size in the "new" construct of the module. We shall see if this is in the next release.$terminal->slave->clone_winsize_from(\*STDIN);
Actually what I suggested he add to his module was the following code:
Since STDIN may not always be a tty and thus will fail a POSIX tty check in Tty.pm, I added a check for that and then explicitly set the terminal size using ioctl() manually if Tty.pm fails to do so.unless (eval{$self->clone_winsize_from(\*STDIN);}) { my $winsize = pack('SSSS', 25, 80, 0, 0); # rows, cols, #pixelsX, + #pixelsY ioctl($self->slave(), &IO::Tty::Constant::TIOCSWINSZ, $winsize); }
This should cover both possibilities, but the portion that still allows Tty.pm to try and set it could be removed all together and just have Expect.pm explicitly set it itself every time. The above code (either method) can be added to your particular expect script too untill Expect.pm has this code. Just be sure to have the proper OO path for the function call (ie. $term->slave->clone_winsize_from(\*STDIN);).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Expect.pm early termination?
by Anonymous Monk on Mar 10, 2017 at 04:48 UTC |