# # # patch "lib/Monotone/AutomateStdio.pm" # from [004d8895d7ebd095ce99445e35057d857c9e3871] # to [171b42352237bf45ea6a6e906ba5d98c7cbcff4a] # ============================================================ --- lib/Monotone/AutomateStdio.pm 004d8895d7ebd095ce99445e35057d857c9e3871 +++ lib/Monotone/AutomateStdio.pm 171b42352237bf45ea6a6e906ba5d98c7cbcff4a @@ -4605,7 +4605,6 @@ sub mtn_read_output_format_2($$) $handler_timeout, $header, $i, - $last_msg, $offset_ref, $size, $stream); @@ -4736,6 +4735,9 @@ sub mtn_read_output_format_2($$) if ($stream ne "l") { + + # Process non-last messages. + if ($size > 0) { @@ -4786,6 +4788,11 @@ sub mtn_read_output_format_2($$) } elsif ($size == 1) { + + my $last_msg; + + # Process the last message. + if (! sysread($this->{mtn_out}, $err_code, 1)) { croak("sysread failed: " . $!); @@ -4795,7 +4802,22 @@ sub mtn_read_output_format_2($$) { $err_occurred = 1; } + + # Send the terminating last message down any stream file handle + # that had data sent down it. + $last_msg = $header . $err_code; + foreach my $ostream ("p", "t") + { + if ($details{$ostream}->{used}) + { + if (! $details{$ostream}->{handle}->print($last_msg)) + { + croak("print failed: " . $!); + } + } + } + } else { @@ -4807,20 +4829,6 @@ sub mtn_read_output_format_2($$) ++ $this->{cmd_cnt}; - # Send the terminating last message down any stream file handle that had - # data sent down it. - - foreach $stream ("p", "t") - { - if ($details{$stream}->{used}) - { - if (! $details{$stream}->{handle}->print($last_msg)) - { - croak("print failed: " . $!); - } - } - } - # Record any error or warning messages. if (${$details{e}->{buffer_ref}} ne "")