in reply to Re^2: Net::OpenSSH loosing lines ins reply
in thread Net::OpenSSH loosing lines ins reply

... and even more fun....

changed the printing part of the script:

my $tmpcnt=0; open TWO, ">", "./two.out"; foreach (@rawout) { print "$tmpcnt: ". $_; print TWO "$tmpcnt: ". $_; $tmpcnt++; }


after running I "tee" stdout to a file and "wc -l" after "tee".
Sometimes "wc -l" shows a reduced number.
Then, the tee'ed file also misses a block of lines.
BUT two.out contains all of them.

argh!

Replies are listed 'Best First'.
Re^4: Net::OpenSSH loosing lines ins reply
by salva (Canon) on Jun 04, 2014 at 12:07 UTC
    Which PerlIO layers are attached to the file handlers?
    use Data::Dumper; my $tmpcnt=0; open TWO, ">", "./two.out"; print STDERR Dumper [PerlIO::get_layers(\*STDOUT)]; print STDERR Dumper [PerlIO::get_layers(\*TWO)]; foreach (@rawout) { print "$tmpcnt: ". $_; print TWO "$tmpcnt: ". $_; $tmpcnt++; }
      $VAR1 = [ 'unix', 'perlio' ]; $VAR1 = [ 'unix', 'perlio' ];


      thinking the direction: is OpenSSH fiddling around with "my" STDOUT? Feels like I cannot print to STDOUT for a very short time...
        No.

        Can you use the diff program to show the differences between both versions?

        diff -u $ONE $TWO