diff options
author | doy <doy@tozt.net> | 2009-02-04 22:58:08 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2009-02-04 22:58:08 -0500 |
commit | 9167bac93742e0816467f3e06f7222d40707a545 (patch) | |
tree | 0eb769db13c2c632bcf1d559ee0f77b5f7de154f | |
parent | 4469b61e3290813269678a16ba3508de086f6f0f (diff) | |
download | io-pty-easy-9167bac93742e0816467f3e06f7222d40707a545.tar.gz io-pty-easy-9167bac93742e0816467f3e06f7222d40707a545.zip |
need to preserve $pty->read returning undef on timeout
-rw-r--r-- | lib/IO/Pty/Easy.pm | 7 |
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; } # }}} |