From: Steinar H. Gunderson Date: Sat, 16 Jun 2007 00:13:26 +0000 (+0200) Subject: Hopefully fix the infamous select issues. X-Git-Url: https://git.sesse.net/?p=remoteglot;a=commitdiff_plain;h=f1ce090bd12cb4478c9226eded7e8ecf0917e377;hp=3991b81c05e25f13cc6ec9e4cc18896d9247fc0e Hopefully fix the infamous select issues. --- 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;