diff options
author | Keith Winstein <keithw@mit.edu> | 2012-03-07 01:49:28 -0500 |
---|---|---|
committer | Keith Winstein <keithw@mit.edu> | 2012-03-07 02:47:47 -0500 |
commit | 6a7afb381dd24458f4d52334d82750777743ff02 (patch) | |
tree | 78a96e0f8ca4ab3d7250f9ed90d7f93deb495e70 /scripts | |
parent | 568f7d9b965e2a42b9aa27a4fb56428965fdd4b6 (diff) |
Avoid leaving fake-proxy processes running
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/mosh | 5 |
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; |