scripts/mosh: Fix hang when remote closes the connection
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
committed by
John Hood
parent
9eeb2fbffa
commit
b58e750daf
@@ -219,11 +219,14 @@ if ( defined $fake_proxy ) {
|
|||||||
|
|
||||||
defined( my $pid = fork ) or die "$0: fork: $!\n";
|
defined( my $pid = fork ) or die "$0: fork: $!\n";
|
||||||
if ( $pid == 0 ) {
|
if ( $pid == 0 ) {
|
||||||
|
close STDIN;
|
||||||
cat $sock, \*STDOUT; $sock->shutdown( 0 );
|
cat $sock, \*STDOUT; $sock->shutdown( 0 );
|
||||||
_exit 0;
|
_exit 0;
|
||||||
}
|
}
|
||||||
$SIG{ 'HUP' } = 'IGNORE';
|
$SIG{ 'HUP' } = 'IGNORE';
|
||||||
|
close STDOUT;
|
||||||
cat \*STDIN, $sock; $sock->shutdown( 1 );
|
cat \*STDIN, $sock; $sock->shutdown( 1 );
|
||||||
|
close STDIN;
|
||||||
waitpid $pid, 0;
|
waitpid $pid, 0;
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user