From 9167bac93742e0816467f3e06f7222d40707a545 Mon Sep 17 00:00:00 2001 From: doy Date: Wed, 4 Feb 2009 22:58:08 -0500 Subject: need to preserve $pty->read returning undef on timeout --- lib/IO/Pty/Easy.pm | 7 +++++-- 1 file 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; } # }}} -- cgit v1.2.3-54-g00ecf