part of making rcmd work again for async cmds
authorDirk Koopman <djk@tobit.co.uk>
Tue, 18 Feb 2020 00:38:09 +0000 (00:38 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Tue, 18 Feb 2020 00:38:09 +0000 (00:38 +0000)
cmd/show/dx.pl
cmd/show/groups.pl
perl/DXCommandmode.pm

index 192d252fce49addc2c46c79bb40c95d5497a5f81..19396a70eff5366dbd57b945d992d9985451802b 100644 (file)
@@ -407,7 +407,7 @@ push @out, $self->spawn_cmd("sh/dx $line", \&Spot::search,
                                                                        }
                                                                }
                                                                push @out, $self->msg('e3', "sh/dx", "'$line'") unless @out;
-                                                               $dxchan->send(@out);
+                                                               return @out;
                                                        });
 
 #my @res = Spot::search($expr, $fromday, $today, $from, $to, $hint, $dofilter ? $self : undef);
index 26aad008a88a3dcb05a9738f88bca87c1cb48d72..8cbf54e6c2940b10faf20593b03aad0a0c84410a 100644 (file)
@@ -103,7 +103,7 @@ sub handle
                                                                        }
                                                                        push (@out, "-");
                                                                }
-                                                               $self->send(@out) if @out;
+                                                               return @out;
                                                        });
        
        #       my @chatlog = DXLog::print(undef, $to, $main::systime, 'chat', undef);
index cbba3b79210bf5ebfa0a77f8377ad57ff80816a6..4212d968b236aaf408288bd09a55930d0a102b8b 100644 (file)
@@ -1328,9 +1328,10 @@ sub spawn_cmd
                                         return;
                                 }
                                 if ($cb) {
-                                        $cb->($dxchan, @res);
-                                } else {
-                                        return unless @res;
+                                        # transform output if required
+                                        @res = $cb->($dxchan, @res);
+                                }
+                                if (@res) {
                                         if (defined $prefix) {
                                                 $dxchan->send(map {"$prefix$_"} @res);
                                         } else {