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