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

misc(refactor): reduce code duplication use process.exitCode instead of process.exit #272

Merged
merged 3 commits into from
Feb 21, 2018

Conversation

EugeneHlushko
Copy link
Member

What kind of change does this PR introduce?

  • small code duplication reduce
  • use process.exitCode = 1 vs process.exit(1)

https://nodejs.org/dist/latest-v9.x/docs/api/process.html#process_process_exit_code

Rather than calling process.exit() directly, the code should set the process.exitCode and allow the process to exit naturally by avoiding scheduling any additional work for the event loop:

Did you add tests for your changes?
no

If relevant, did you update the documentation?
not relevant

Summary
Progressing in the bin directory

Does this PR introduce a breaking change?
no

Other information
none

@evenstensberg
Copy link
Member

Mind checking out the failing test cases? Might be cause exitCode is async, so the tests get polluted

@evenstensberg evenstensberg changed the title Misc/refactor misc(refactor): use process.exitCode instead of process.exit Feb 20, 2018
@EugeneHlushko EugeneHlushko changed the title misc(refactor): use process.exitCode instead of process.exit misc(refactor): reduce code duplication use process.exitCode instead of process.exit Feb 21, 2018
}
const isArray = Array.isArray(argv[name]);
const isSet = typeof argv[name] !== "undefined" && argv[name] !== null;
if (!isArray || !isSet) return;
Copy link
Member Author

@EugeneHlushko EugeneHlushko Feb 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm there was wrong operator in a cond here, should be if (!isArray && !isSet) return;

@webpack-bot
Copy link

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

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

Successfully merging this pull request may close these issues.

None yet

4 participants