summaryrefslogtreecommitdiffstats
path: root/lib/IO/Pty/Easy.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/IO/Pty/Easy.pm')
-rw-r--r--lib/IO/Pty/Easy.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/IO/Pty/Easy.pm b/lib/IO/Pty/Easy.pm
index ab6a51d..0a6bbf1 100644
--- a/lib/IO/Pty/Easy.pm
+++ b/lib/IO/Pty/Easy.pm
@@ -211,8 +211,11 @@ sub read {
my $nchars = sysread($self->{pty}, $buf, $max_chars);
$buf = '' if defined($nchars) && $nchars == 0;
}
- $buf = $self->{final_output} . $buf;
- $self->{final_output} = '';
+ if (length($self->{final_output}) > 0) {
+ no warnings 'uninitialized';
+ $buf = $self->{final_output} . $buf;
+ $self->{final_output} = '';
+ }
return $buf;
}
# }}}