better error messages when no command is given to zmcontrol

This commit is contained in:
Isaac Connor 2019-10-08 18:06:52 -04:00
parent af6ead60a5
commit 55b1d29927
1 changed files with 7 additions and 4 deletions

View File

@ -29,7 +29,7 @@ use Getopt::Long;
use autouse 'Pod::Usage'=>qw(pod2usage);
use POSIX qw/strftime EPIPE/;
use Socket;
#use Data::Dumper;
use Data::Dumper;
use Module::Load::Conditional qw{can_load};
use constant MAX_CONNECT_DELAY => 15;
@ -173,14 +173,17 @@ if ( $options{command} ) {
next if !$message;
my $params = jsonDecode($message);
#Debug( Dumper( $params ) );
Debug( Dumper( $params ) );
my $command = $params->{command};
close(CLIENT);
if ( $command eq 'quit' ) {
last;
}
} elsif ( $command ) {
$control->$command($params);
} else {
Warning("No command in $message");
}
} else {
Fatal('Bogus descriptor');
}