-
Notifications
You must be signed in to change notification settings - Fork 79
exit if node version too low #226
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just requesting a change in case you missed semver.satisfies
. Really cool to have this one, will work great also as a smoke test for the release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo this definitely needs to exit instead of warn (so what you have here is good). If, for some reason, somebody's system is on pre node 4.x, they will not be able to do very much in our shell.
packages/cli-repl/src/cli-repl.ts
Outdated
console.log(`${clr('Using Mongosh Beta', ['bold', 'yellow'])}: ${version}`); | ||
console.log(`${MONGOSH_WIKI}`); | ||
if (semver.lt(process.version, engines.node.replace('^', ''))) { | ||
console.log(`WARNING: mismatched node version. Minimum node version required ${engines.node}. Currently using ${process.version}. Exiting...\n\n`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe let's throw an MongoshUnsupportedError
here?
Message is really good though -- super clear with node versions, hopefully will lead to less bug reports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have unsupported, we only have unimplemented, which I think doesn't match this use case. I can change it to RuntimeError
Actually it doesn't make sense to throw an error right before exiting because we would need to catch that error otherwise the process.exit
code is unreachable. I moved the check to the constructor so we don't have a writer either. I think it should stay as is.
(omg sorry for all the comments on such a tiny PR 😅 😅 😅 ) |
Never a problem on the many comments, I opened this PR as a way of starting this conversation :) |
Should we exit or just warn?