Skip to content

Missing required flags does not trigger ExitErrHandler #2145

@bigluck

Description

@bigluck

Hi everyone.

We're using the latest version (v3.3.3) of the library, and we noticed that when a command has one or more flags set as Required but they're not defined by the user, the library exits by printing the command's help without invoking any callback functions (OnUsageError or OnUsageError).

https://github.com/urfave/cli/blob/cb0fc213cc26317b82f7a9ef9352da7cc8e185e5/command_run.go#L224C1-L229C3

It's strange because the code block before and after checkAllRequiredFlags always calls deferErr = cmd.handleExitCoder(ctx, err) before returning the error, while in the case of required flags, the error is directly returned to the caller.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/v3relates to / is being considered for v3kind/bugdescribes or fixes a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions