diff options
Diffstat (limited to 'lib/App/Termcast.pm')
-rw-r--r-- | lib/App/Termcast.pm | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/App/Termcast.pm b/lib/App/Termcast.pm index 9f7adca..a189060 100644 --- a/lib/App/Termcast.pm +++ b/lib/App/Termcast.pm @@ -63,17 +63,22 @@ sub run { if (vec($rout, fileno(STDIN), 1)) { my $buf; sysread STDIN, $buf, 4096; + if (!$buf) { + warn "Error reading from stdin: $!" unless defined $buf; + last; + } $pty->write($buf); } if (vec($rout, fileno($pty->{pty}), 1)) { my $buf = $pty->read(0); + if (!$buf) { + warn "Error reading from pty: $!" unless defined $buf; + last; + } syswrite STDOUT, $buf; $socket->write($buf); } } - if ($!) { - warn "Error reading: $!\n"; - } } __PACKAGE__->meta->make_immutable; |