Skip to content

Commit 39568c2

Browse files
authored
Merge pull request #6821 from chu11/issue6636_flux_module_error_message
flux-module: require argument for flux module stats
2 parents 9d6596b + 750c75b commit 39568c2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/cmd/flux-module.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,11 +648,11 @@ int cmd_stats (optparse_t *p, int argc, char **argv)
648648
flux_future_t *f = NULL;
649649
flux_t *h;
650650

651-
if ((n = optparse_option_index (p)) < argc - 1) {
651+
if ((n = optparse_option_index (p)) != (argc - 1)) {
652652
optparse_print_usage (p);
653653
exit (1);
654654
}
655-
service = n < argc ? argv[n++] : "broker";
655+
service = argv[n];
656656
nodeid = FLUX_NODEID_ANY;
657657

658658
if (!(h = flux_open (NULL, 0)))

t/t0003-module.t

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ test_expect_success 'flux module stats --rusage --parse maxrss works' '
206206
test "$RSS" -gt 0
207207
'
208208

209+
test_expect_success 'flux module stats with no args is an error' '
210+
test_must_fail flux module stats 2> usage.out &&
211+
grep -i "usage" usage.out
212+
'
213+
209214
# try to hit some error cases
210215

211216
test_expect_success 'flux module with no arguments prints usage and fails' '

0 commit comments

Comments
 (0)