Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process.exit(64) #435

Closed
hildjj opened this issue Sep 14, 2015 · 3 comments
Closed

process.exit(64) #435

hildjj opened this issue Sep 14, 2015 · 3 comments

Comments

@hildjj
Copy link

hildjj commented Sep 14, 2015

When you call exit, the return code probably should not be 0 (success). Traditionally, option parsing errors have resulted in error code 64, as documented in many systems' sysexits.h header file, which on my system says:

#define EX_USAGE    64  /* command line usage error */

I would be happy to submit a PR if you're open to this change.

@hildjj
Copy link
Author

hildjj commented Sep 14, 2015

I'll also fix #188 at the same time.

hildjj added a commit to hildjj/commander.js that referenced this issue Sep 15, 2015
@pcdevil
Copy link

pcdevil commented Feb 25, 2016

@hildjj Hi,
first of all, thanks the pull request, it would be really helpful to use this! (+1 from me)

But I don't think in the current form this fixes #188. It wants an optional exit code for help, mainly because of something went wrong and we are gracefully exiting strategy. Something like this:

function addUser (userName, options) {
    if (!Users.hasUser(userName)) {
        errorOutput('unknown user:', userName);
        program.help(1); // wrong parameters, print help and exit
    }

    // do something awesome
}

Of course with your modification you can do this by executing program.exitCode(1) && program.help(); but it's not cleaner than calling program.outputHelp() && process.exit(1);.

It would be nice (but not necessity) to combine these statements.

If you invite me to your reposity I'm happy to collaborate.

@shadowspawn
Copy link
Collaborator

Referenced from #945

This issue has not had any activity in over six months. It isn't likely to get acted on due to this report.

Feel free to open a new issue if it comes up again, with new information and renewed interest.

Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants