--- deliantra/server/ext/dm-support.ext 2007/09/20 12:30:28 1.11 +++ deliantra/server/ext/dm-support.ext 2007/09/30 22:33:52 1.12 @@ -9,15 +9,13 @@ sub tcp_serve($) { my ($fh) = @_; - select $fh; - binmode $fh, ":raw:perlio:utf8"; my $buf; my ($a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p, $q, $r, $s, $t, $u, $v, $w, $x, $y, $z); my (%l, @l); # for use by shell users - print < "; + print $fh "\n> "; Event->io (fd => $fh, poll => 'r', data => 0, cb => sub { if (defined (my $cmd = <$fh>)) { $cmd =~ s/\s+$//; + select $fh; if ($cmd =~ /^\s*exit\b/i) { print "will not exit() server.\n"; } elsif ($cmd =~ s/^coro\s+// or $cmd =~ /^(?:ps|bt\s)/) { @@ -64,6 +63,8 @@ print "evaluation error: $@\n" if $@; print "result:\n", cf::dumpval @res > 1 ? \@res : $res[0] if @res; print "\n> "; + + select STDOUT; }; if ($cmd =~ s/\s*&$//) { @@ -77,6 +78,7 @@ } print "\n> "; + select STDOUT; } else { $_[0]->w->cancel; }