X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=perl%2FDXCron.pm;h=757ec61cd640756b6b6d7587c1e62f06143e81bc;hb=812bf47870fa01eccce9d08c8a053659b8ddc6a1;hp=e90865f385d989217b459494bf3b47644504ddc5;hpb=5027f11ff4012d7f974ffc179dff9b6ff118f8af;p=spider.git diff --git a/perl/DXCron.pm b/perl/DXCron.pm index e90865f3..757ec61c 100644 --- a/perl/DXCron.pm +++ b/perl/DXCron.pm @@ -247,7 +247,7 @@ sub spawn my $fc = Mojo::IOLoop::ForkCall->new; $fc->run( sub {my @res = `$line`; return @res}, - undef, + [], sub { my ($fc, $err, @res) = @_; if (defined $err) { @@ -255,7 +255,33 @@ sub spawn dbg($s); return; } - dbg("DXCron::spawn: $_") for @res; + for (@res) { + chomp; + dbg("DXCron::spawn: $_") if isdbg("cron"); + } + } + ); +} + +sub spawn_cmd +{ + my $line = shift; + + dbg("spawn_cmd run: $line") if isdbg('cron'); + my $fc = Mojo::IOLoop::ForkCall->new; + $fc->run( + sub {my @res = DXCommandmode::run_cmd($main::me, $line); return @res}, + [], + sub { + my ($fc, $err, @res) = @_; + if (defined $err) { + my $s = "spawn_cmd: error $err"; + dbg($s); + } + for (@res) { + chomp; + dbg("spawn_cmd: $_") if isdbg("cron"); + } } ); }