X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=remoteglot.pl;h=4911b2cc43dac72b7e7a4a03b20b83c669c6e906;hb=f1ce090bd12cb4478c9226eded7e8ecf0917e377;hp=c64fb41ceb1eea3b5e215afa2f3c676c253fc343;hpb=3991b81c05e25f13cc6ec9e4cc18896d9247fc0e;p=remoteglot diff --git a/remoteglot.pl b/remoteglot.pl index c64fb41..4911b2c 100644 --- a/remoteglot.pl +++ b/remoteglot.pl @@ -63,10 +63,11 @@ $t->cmd("observe $target"); print "FICS ready.\n"; while (1) { my $rin = ''; + my $rout; vec($rin, fileno(UCIREAD), 1) = 1; vec($rin, fileno($t), 1) = 1; - my ($nfound, $timeleft) = select($rin, undef, undef, 5.0); + my ($nfound, $timeleft) = select($rout=$rin, undef, undef, 5.0); my $sleep = 1.0; while (1) { @@ -89,7 +90,7 @@ while (1) { } # any fun on the UCI channel? - if (vec($rin, fileno(UCIREAD), 1)) { + if ($nfound > 0 && vec($rout, fileno(UCIREAD), 1) == 1) { my $line = ; chomp $line; $line =~ tr/\r//d;