From: Adrian P. <ad...@po...> - 2003-07-20 10:13:23
|
I've written a module that uses Expect to control a remote shell session using either rsh or ssh (rcp not really tested). It also allows files to be copied back and forth through the session. One problem I had a hard time figuring out was a copy of a binary file from the remote end of the connection to the local end which kept coming short. Eventually, after much debugging of my own code, I found a small but nasty hack in Expect :- # ugly hack for broken solaris ttys that spew <blank><backspace> # into our pretty output $buffer =~ s/ \cH//g; Argh !! :-) Anyway, I think the hack is okay but should not really be enabled by default. Thus the following patch. Of course the way I'm using Expect may be the biggest problem :-) Comments. Sincerely, Adrian Phillips -- Who really wrote the works of William Shakespeare ? http://www.pbs.org/wgbh/pages/frontline/shakespeare/ --- libexpect-perl-1.15/Expect.pm 2003-07-04 14:07:46.000000000 +0200 +++ libexpect-perl-1.15.1/Expect.pm 2003-07-04 14:13:51.000000000 +0200 @@ -53,6 +53,7 @@ @Expect::Before_List = (); @Expect::After_List = (); %Expect::Spawned_PIDs = (); + $Expect::Broken_space_backspace = 0; } sub version { @@ -859,7 +860,7 @@ # ugly hack for broken solaris ttys that spew <blank><backspace> # into our pretty output - $buffer =~ s/ \cH//g; + $buffer =~ s/ \cH//g if $Expect::Broken_space_backspace; # Append it to the accumulator. ${*$exp}{exp_Accum} .= $buffer; if (exists ${*$exp}{exp_Max_Accum} |