X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXProt.pm;h=4940c9102116050b86eae9604fafc732b34d849b;hb=c480ac94da7dbd5762fcd15aa556c874d223e14e;hp=d7e34e61e7c927dd23840b50a75dfe8cd0676718;hpb=ed993b76a84e36b22efd1fc762d6a466497bcf7e;p=spider.git diff --git a/perl/DXProt.pm b/perl/DXProt.pm index d7e34e61..4940c910 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -254,6 +254,7 @@ sub init $main::me->{version} = $main::version; $main::me->{build} = $main::build; $main::me->{do_pc9x} = 1; + $main::me->{hostname} = $main::clusteraddr; $main::me->update_pc92_next($pc92_short_update_period); $main::me->update_pc92_keepalive; } @@ -1218,21 +1219,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')) { - my $s = "line: $line"; - $s .= ", args: " . join(', ', @$args) if $args && @$args; + if (isdbg('progress')) { + my $s = qq{line: "$line"}; + $s .= ", args: " . join(', ', map { defined $_ ? qq{'$_'} : q{'undef'} } @$args) if $args && @$args; + dbg($s); } - - my @res = $cmdref->(@$args); -# diffms("by $call 1", $line, $t0, scalar @res) if isdbg('chan'); - return @res; + eval { @out = $cmdref->(@$args); }; + if ($@) { + DXDebug::dbgprintring(25); + push @out, DXDebug::shortmess($@); + } + return @out; }, # $args, sub { @@ -1261,7 +1272,7 @@ sub spawn_cmd $self->send(@res); } } - diffms("rcmd from $user on $call", $line, $t0, scalar @res) if isdbg('chan'); + diffms("rcmd from $user on $call", $line, $t0, scalar @res) if isdbg('progress'); }); return @out;