--- deliantra/Deliantra-Client/DC/MapWidget.pm 2006/10/08 21:54:20 1.86 +++ deliantra/Deliantra-Client/DC/MapWidget.pm 2006/10/09 01:06:36 1.88 @@ -82,19 +82,7 @@ my $editsup = $::CONN && $::CONN->{editor_support} or return; - my ($pid, $fh); - unless ($pid = open $fh, "-|:utf8", "-") { - $SIG{__DIE__} = sub { - warn "FATAL: @_\n"; - CFPlus::_exit 99; - }; - - open STDERR, ">&STDOUT"; - binmode STDOUT, ":utf8"; - binmode STDERR, ":utf8"; - close $fh; - - $| = 1; + CFPlus::background { print "preparing editor startup...\n"; CFPlus::set_proxy; @@ -126,6 +114,10 @@ if (1) { # upload a map my $mapname = $::CONN->{map_info}[0]; + my $mappath = "$mapdir/$mapname"; + + -e $mappath and die "$mappath already exists\n"; + print "getting map revision for $mapname...\n"; # try to get the most recent head revision, what a hack, @@ -146,18 +138,16 @@ cf_login => $::PROFILE->{user}, }; - my $mappath = "$mapdir/$mapname"; - require File::Basename; require File::Path; File::Path::mkpath (File::Basename::dirname ($mappath)); open my $fh, ">:raw:perlio", "$mappath.meta" - or die "$mappath.meta: $!"; + or die "$mappath.meta: $!\n"; print $fh CFPlus::to_json $meta; close $fh; open my $fh, ">:raw:perlio:utf8", $mappath - or die "$mappath: $!"; + or die "$mappath: $!\n"; print $fh $map; close $fh; @@ -195,24 +185,7 @@ die "viewvc parse error, unable to detect revision\n"; } } - - CFPlus::_exit; } - - my $buffer; - - Event->io (fd => $fh, poll => 'r', cb => sub { - unless (sysread $fh, $buffer, 4096, length $buffer) { - $_[0]->w->cancel; - $buffer .= "done\n"; - } - - while ($buffer =~ s/^(.*)\n//) { - ::message ({ - markup => "editor($pid): " . CFPlus::asxml $1, - }); - } - }); } sub invoke_button_down {