X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fclient.pl;h=fb86542f394dbfdf760d56acb1fe0402c5d0eceb;hb=97315924f561c56cef3b581691409d4217f5c1b5;hp=1a57a1c6e983bb229d283fe4f040ff0aee9e3c2a;hpb=6897e4adf0c591b13b2f9270f9b59158463dac49;p=spider.git diff --git a/perl/client.pl b/perl/client.pl index 1a57a1c6..fb86542f 100755 --- a/perl/client.pl +++ b/perl/client.pl @@ -163,7 +163,9 @@ sub rec_stdin # $prbuf =~ s/\r/\\r/; # $prbuf =~ s/\n/\\n/; # print "sys: $r ($prbuf)\n"; - if ($r > 0) { + if (!defined $r || $r == 0) { + cease(1); + } elsif ($r > 0) { if ($mode) { $buf =~ s/\r/\n/og if $mode == 1; $buf =~ s/\r\n/\n/og if $mode == 2; @@ -189,9 +191,7 @@ sub rec_stdin } else { $conn->send_later("I$call|$buf"); } - } elsif ($r == 0) { - cease(1); - } + } $lasttime = time; } @@ -225,6 +225,8 @@ sub doconnect $rfh = new IO::File; $wfh = new IO::File; $pid = open2($rfh, $wfh, "$line") or die "can't do $line $!"; + die "no receive channel $!" unless $rfh; + die "no transmit channel $!" unless $wfh; dbg('connect', "got pid $pid"); $wfh->autoflush(1); } else {