-
Notifications
You must be signed in to change notification settings - Fork 28.9k
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
child_process: remove unused argument #37923
Conversation
nit: removed -> remove in the commit message |
lib/child_process.js
Outdated
@@ -600,7 +600,7 @@ function abortChildProcess(child, killSignal) { | |||
|
|||
function spawn(file, args, options) { | |||
options = normalizeSpawnArguments(file, args, options); | |||
validateTimeout(options.timeout, 'options.timeout'); | |||
validateTimeout(options.timeout); |
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.
Hmm.. should we alternatively modify the validator function to use the name?
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.
I think that is a good idea.
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.
This is a validator function defined and used only in this file. If we add that argument, it would always be the same string literal, 'options.timeout'
. It never validates anything that isn't options.timeout
. I'd prefer to leave it alone unless/until that becomes a feature it needs.
I will note that it currently reports this as the error message:
The value of "timeout" is out of range. It must be an unsigned integer.
I think that's not at all a problem as the user will know they sent a "timeout" property (and may not always know what "options" refers to without looking at the docs). But if we want to update that to say "options.timeout", let's just update it inside validateTimeout()
and not add a basically unused second argument. YAGNI and all that.
Landed in db7df59 |
The internal validateTimeout() takes a single parameter, so do not pass a second value. PR-URL: #37923 Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
The internal validateTimeout() takes a single parameter, so do not pass a second value. PR-URL: #37923 Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
The internal validateTimeout() takes a single parameter, so do not pass
a second value.