Avoid leaving fake-proxy processes running
This commit is contained in:
+3
-2
@@ -97,8 +97,8 @@ if ( defined $fake_proxy ) {
|
|||||||
my ( $from, $to ) = @_;
|
my ( $from, $to ) = @_;
|
||||||
while ( my $n = $from->sysread( my $buf, 4096 ) ) {
|
while ( my $n = $from->sysread( my $buf, 4096 ) ) {
|
||||||
next if ( $n == -1 && $! == EINTR );
|
next if ( $n == -1 && $! == EINTR );
|
||||||
$n >= 0 or die "$0: read: $!\n";
|
$n >= 0 or last;
|
||||||
$to->write( $buf ) or die "$0: write: $!\n";
|
$to->write( $buf ) or last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,6 +107,7 @@ if ( defined $fake_proxy ) {
|
|||||||
cat $sock, \*STDOUT; $sock->shutdown( 0 );
|
cat $sock, \*STDOUT; $sock->shutdown( 0 );
|
||||||
_exit 0;
|
_exit 0;
|
||||||
}
|
}
|
||||||
|
$SIG{ 'HUP' } = 'IGNORE';
|
||||||
cat \*STDIN, $sock; $sock->shutdown( 1 );
|
cat \*STDIN, $sock; $sock->shutdown( 1 );
|
||||||
waitpid $pid, 0;
|
waitpid $pid, 0;
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
Reference in New Issue
Block a user