--- deliantra/Deliantra-Client/DC.pm 2006/10/09 01:06:36 1.123 +++ deliantra/Deliantra-Client/DC.pm 2006/10/11 23:34:24 1.124 @@ -79,12 +79,7 @@ my $pid = fork; if (defined $pid && !$pid) { - $SIG{__DIE__} = sub { - my $msg = $_[0]; - $msg =~ s/\n+/\n/; - warn "FATAL: $msg"; - CFPlus::_exit 99; - }; + local $SIG{__DIE__}; open STDOUT, ">&", $fh_w; open STDERR, ">&", $fh_w; @@ -93,12 +88,19 @@ $| = 1; - $cb->(); + eval { $cb->() }; + + if ($@) { + my $msg = $@; + $msg =~ s/\n+/\n/; + warn "FATAL: $msg"; + CFPlus::_exit 1; + } # win32 is fucked up, of course. exit will clean stuff up, # which destroys our database etc. _exit will exit ALL # forked processes, because of the dreaded fork emulation. - CFPlus::_exit 0; + CFPlus::_exit 0; } close $fh_w; @@ -113,6 +115,7 @@ while ($buffer =~ s/^(.*)\n//) { my $line = $1; + $line =~ s/\s+$//; utf8::decode $line; ::message ({ markup => "editor($pid): " . CFPlus::asxml $line,