summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-03-15 12:16:19 -0500
committerJesse Luehrs <doy@tozt.net>2011-03-15 12:16:19 -0500
commit894a6737658c1e149f9db626bc9f0dd64d454262 (patch)
treeb46dfa2931d4b43530477d1dc3ae3268d8d623df
parent005b9e6325b31d11294fcebcdb0a1d55f88171e9 (diff)
downloadapp-termcast-894a6737658c1e149f9db626bc9f0dd64d454262.tar.gz
app-termcast-894a6737658c1e149f9db626bc9f0dd64d454262.zip
don't leave the terminal in raw mode when the socket can't connect
-rw-r--r--lib/App/Termcast.pm13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/App/Termcast.pm b/lib/App/Termcast.pm
index 48a8734..6b98403 100644
--- a/lib/App/Termcast.pm
+++ b/lib/App/Termcast.pm
@@ -244,6 +244,8 @@ sub run {
my $self = shift;
my @cmd = @_;
+ $self->socket;
+
ReadMode 5;
my $guard = Scope::Guard->new(sub { ReadMode 0 });
@@ -267,7 +269,10 @@ sub run {
}
if ($self->_socket_ready($eout)) {
+ ReadMode 0;
$self->clear_socket;
+ $self->socket;
+ ReadMode 5;
}
if ($self->_in_ready($rout)) {
@@ -303,13 +308,11 @@ sub run {
my $buf;
$self->socket->recv($buf, 4096);
if (!defined $buf || length $buf == 0) {
- if ($self->_got_winch) {
- $self->_got_winch(0);
- redo;
- }
-
if (defined $buf) {
+ ReadMode 0;
$self->clear_socket;
+ $self->socket;
+ ReadMode 5;
}
else {
Carp::croak("Error reading from socket: $!");