X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXProt.pm;h=1f631120800c42db0de01096540941b08d981d48;hb=931777f77682d04a945ef31886bd5ab6569fc55d;hp=9493637a87aef29912c66ebb217752b0fd543a02;hpb=abbcfa7500858a2eba4135b0af5db9f3fca8d68e;p=spider.git diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 9493637a..1f631120 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -1218,20 +1218,31 @@ sub spawn_cmd my $fc = Mojo::IOLoop::Subprocess->new; # just behave normally if something has set the "one-shot" _nospawn in the channel - return ($cmdref->(@$args)) if $self->{_nospawn}; + if ($self->{_nospawn}) { + eval { @out = $cmdref->(@$args); }; + if ($@) { + DXDebug::dbgprintring(25); + push @out, DXDebug::shortmess($@); + } + return @out; + } # $fc->serializer(\&encode_json); # $fc->deserializer(\&decode_json); $fc->run( sub { my $subpro = shift; - if (isdbg('chan')) { + if (isdbg('progress')) { my $s = "line: $line"; $s .= ", args: " . join(', ', @$args) if $args && @$args; + dbg($s); } - - my @res = $cmdref->(@$args); - return @res; + eval { @out = $cmdref->(@$args); }; + if ($@) { + DXDebug::dbgprintring(25); + push @out, DXDebug::shortmess($@); + } + return @out; }, # $args, sub { @@ -1260,7 +1271,7 @@ sub spawn_cmd $self->send(@res); } } - DXCommandmode::_diffms($call, $line, $t0); + diffms("rcmd from $user on $call", $line, $t0, scalar @res) if isdbg('progress'); }); return @out;