scripts/mosh: Fix hang when remote closes the connection

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg
2014-01-29 05:00:31 -05:00
committed by John Hood
parent 9eeb2fbffa
commit b58e750daf
+3
View File
@@ -219,11 +219,14 @@ if ( defined $fake_proxy ) {
defined( my $pid = fork ) or die "$0: fork: $!\n";
if ( $pid == 0 ) {
close STDIN;
cat $sock, \*STDOUT; $sock->shutdown( 0 );
_exit 0;
}
$SIG{ 'HUP' } = 'IGNORE';
close STDOUT;
cat \*STDIN, $sock; $sock->shutdown( 1 );
close STDIN;
waitpid $pid, 0;
exit;
}