--- deliantra/server/lib/cf.pm 2007/07/05 08:10:30 1.297 +++ deliantra/server/lib/cf.pm 2007/07/08 14:50:07 1.298 @@ -423,22 +423,35 @@ close $fh2; my $res = (Coro::Handle::unblock $fh1)->readline (undef); + warn "pst<$res>" unless $res =~ /^pst/; $res = Coro::Storable::thaw $res; waitpid $pid, 0; # should not block anymore, we expect the child to simply behave - die $$res unless "ARRAY" eq ref $res; + Carp::confess $$res unless "ARRAY" eq ref $res; return wantarray ? @$res : $res->[-1]; } else { reset_signals; local $SIG{__WARN__}; local $SIG{__DIE__}; + local $Coro::idle; + $Coro::current->prio (Coro::PRIO_MAX); eval { close $fh1; my @res = eval { $cb->(@args) }; - syswrite $fh2, Coro::Storable::freeze +($@ ? \"$@" : \@res); + + open my $fh, ">", \my $buf + or die "fork_call: cannot open fh-to-buf in child : $!"; + Storable::store_fd +($@ ? \"$@" : \@res), $fh; + close $fh; + + warn "writing ", length $buf; + my $x; + (length $buf) == ($x = syswrite $fh2, $buf) + or warn "error writing ".(length $buf)." != $x\n"; + close $fh2; }; warn $@ if $@;