aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorGravatar Keith Winstein <keithw@mit.edu>2012-03-07 01:49:28 -0500
committerGravatar Keith Winstein <keithw@mit.edu>2012-03-07 02:47:47 -0500
commit6a7afb381dd24458f4d52334d82750777743ff02 (patch)
tree78a96e0f8ca4ab3d7250f9ed90d7f93deb495e70 /scripts
parent568f7d9b965e2a42b9aa27a4fb56428965fdd4b6 (diff)
Avoid leaving fake-proxy processes running
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/mosh5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/mosh b/scripts/mosh
index 8f14abe..e85edb1 100755
--- a/scripts/mosh
+++ b/scripts/mosh
@@ -97,8 +97,8 @@ if ( defined $fake_proxy ) {
my ( $from, $to ) = @_;
while ( my $n = $from->sysread( my $buf, 4096 ) ) {
next if ( $n == -1 && $! == EINTR );
- $n >= 0 or die "$0: read: $!\n";
- $to->write( $buf ) or die "$0: write: $!\n";
+ $n >= 0 or last;
+ $to->write( $buf ) or last;
}
}
@@ -107,6 +107,7 @@ if ( defined $fake_proxy ) {
cat $sock, \*STDOUT; $sock->shutdown( 0 );
_exit 0;
}
+ $SIG{ 'HUP' } = 'IGNORE';
cat \*STDIN, $sock; $sock->shutdown( 1 );
waitpid $pid, 0;
exit;