Skip to content

memtrace <subcommand> --help executes the subcommand instead of printing help (e.g. memtrace start --help starts the daemon) #28

@Regis-RCR

Description

@Regis-RCR

Summary

memtrace start --help does not print usage. It runs start: the daemon comes up and keeps running, exactly as if --help were not there. Top-level memtrace --help prints help fine, so the flag is just not honored once a subcommand is present. Other subcommands look affected the same way.

Steps to reproduce

  1. Have a daemon already running for some data dir.
  2. Run memtrace start --help.

Expected: usage text for start, then exit, with no runtime change.

Actual: the daemon starts and keeps running, and the process does not exit. A daemon I already had running for that data dir was disrupted in the process.

Impact

Reaching for --help to learn a subcommand's flags is how most people discover a CLI. Here it has a side effect. On a machine that already had a daemon running, start --help disrupted it and started up again, mid-session. A read-only "what are the flags" gesture should never change runtime state, and it definitely should not disturb a daemon that was already running.

Environment

memtrace 0.6.46, macOS arm64.

Suggested fix

Honor --help and -h for subcommands the same way the top-level command does: print usage and exit, before anything starts. Today the flag only works at the top level.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions