9 my ($class, $cmdline, $tag) = @_;
11 my ($uciread, $uciwrite);
12 my $pid = IPC::Open2::open2($uciread, $uciwrite, $cmdline);
28 my ($engine, $msg) = @_;
29 print { $engine->{'write'} } "$msg\n";
36 # Read until we've got a full line -- if the engine sends part of
37 # a line and then stops we're pretty much hosed, but that should
40 while ($engine->{'readbuf'} !~ /\n/) {
42 my $ret = sysread $engine->{'read'}, $tmp, 4096;
46 die "error in reading from the UCI engine: $!";
48 die "EOF from UCI engine";
51 $engine->{'readbuf'} .= $tmp;
56 while ($engine->{'readbuf'} =~ s/^([^\n]*)\n//) {