Skip to content

Unknown options lead to program exiting silently without action #961

@laurentseal

Description

@laurentseal

Commander version 2.13.0

Calling commander.js with an unknown option or an unknown command leads to the program exiting silently with an exit status of 0.

Ex.
./commanderjsbinary --option1 "argument1" --boolean-option-1 this-command-doesnt-exist cmd "cmdargs"

Note: The following example is minimal, but in bigger projects with existing options it causes the program to exit without warning if for example the user mistypes an argument. This behaviour is certainly unexpected.

A working minimal example:


const program = require('commander');

program.command('existingOption <argument>').description('bla').action(() => {
});

program.parse(process.argv);



Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions