Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 52aeb2a

Browse filesBrowse files
jvelezpoMylesBorins
authored andcommitted
test: verify the shell option works properly on execFile
Useful for executing in a shell because it accepts arguments as an array instead of a string as exec does. Depending on the circumstances, that can prove to be useful if the arguments are already prepared. PR-URL: #18384 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent ffc8e8e commit 52aeb2a
Copy full SHA for 52aeb2a

File tree

Expand file treeCollapse file tree

2 files changed

+14
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+14
-0
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-child-process-execfile.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-execfile.js
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const uv = process.binding('uv');
66
const fixtures = require('../common/fixtures');
77

88
const fixture = fixtures.path('exit.js');
9+
const execOpts = { encoding: 'utf8', shell: true };
910

1011
{
1112
execFile(
@@ -38,3 +39,10 @@ const fixture = fixtures.path('exit.js');
3839
child.kill();
3940
child.emit('close', code, null);
4041
}
42+
43+
{
44+
// Verify the shell option works properly
45+
execFile(process.execPath, [fixture, 0], execOpts, common.mustCall((err) => {
46+
assert.ifError(err);
47+
}));
48+
}
Collapse file

‎test/sequential/test-child-process-execsync.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-child-process-execsync.js
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const TIMER = 200;
2929
const SLEEP = 2000;
3030

3131
const start = Date.now();
32+
const execOpts = { encoding: 'utf8', shell: true };
3233
let err;
3334
let caught = false;
3435

@@ -141,3 +142,8 @@ assert.strictEqual(ret, `${msg}\n`);
141142
return true;
142143
});
143144
}
145+
146+
// Verify the shell option works properly
147+
assert.doesNotThrow(() => {
148+
execFileSync(process.execPath, [], execOpts);
149+
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.