-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
child_process: validate exec's options.shell
as string
#59185
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ const testCopy = (shellName, shellPath) => { | |
const system32 = `${process.env.SystemRoot}\\System32`; | ||
|
||
// Test CMD | ||
test(true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So this is a breaking change. I personally unvote this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On This is only adding validation of documented behaviour, which by precedent is not a breaking change – not that it's for me to say. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, it is string on document. But I think it's too loose before on runtime, now it's hard to make it back |
||
test(null); | ||
test('cmd'); | ||
testCopy('cmd.exe', `${system32}\\cmd.exe`); | ||
test('cmd.exe'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
require('../common'); | ||
const assert = require('assert'); | ||
const { exec, execSync } = require('child_process'); | ||
|
||
const invalidArgTypeError = { | ||
code: 'ERR_INVALID_ARG_TYPE', | ||
name: 'TypeError' | ||
}; | ||
|
||
for (const fn of [exec, execSync]) { | ||
assert.throws(() => fn('should-throw-on-boolean-shell-option', { shell: false }), invalidArgTypeError); | ||
} | ||
|
||
// TODO: add DEP0196 tests following runtime deprecation |
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.
Do we have a test for when
options.shell
is the empty string?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.
Not at present, that was the whole conversation that led to #58564. There will be one when we get around to a runtime deprecation.