Permalink
Browse files

fix hang when asking for unknown commands

  • Loading branch information...
steveschnepp committed Mar 7, 2012
1 parent 58f03a9 commit f0d8bcdb66a2655c9d7a310de076dcdc1cb7b4d4
Showing with 9 additions and 8 deletions.
  1. +9 −8 tools/pmmn/bin/pmmn
View
@@ -54,6 +54,7 @@ while(my $line = <>) {
next;
} elsif ($cmd eq "nodes") {
print "$host\n";
+ print ".";
next;
} elsif ($cmd eq "quit") {
exit(0);
@@ -67,19 +68,19 @@ while(my $line = <>) {
}
closedir(PLUGIN_DIR);
next;
- } elsif (-e $plugin_filename) {
- my $arg_plugin;
- if ($cmd eq "config") {
- $arg_plugin = "config";
- } elsif ($cmd eq "fetch") {
- $arg_plugin = "";
- } else {
- # Ignore
+ } elsif ($cmd eq "config" || $cmd eq "alert" || $cmd eq "fetch") {
+ if (-d $plugin_filename || ! -x $plugin_filename) {
+ print "# Unknown plugin [$arg] for $cmd";
next;
}
+ my $arg_plugin = ($cmd eq "fetch") ? "" : $cmd;
system($plugin_filename, $arg_plugin);
print ".";
+ next;
}
+
+ # Arriving here is not a good sign
+ print "# Unknown command. Try list, nodes, config, fetch, version, alert or quit";
} continue {
#print " " x 4096;
print "\n";

0 comments on commit f0d8bcd

Please sign in to comment.