Skip to content

Commit 91ff704

Browse files
committed
test: Additional test for execSync
Exercise the call to execSync with a bad shell passed through options. Verify that the right exception is thrown. Signed-off-by: Robert Chiras <[email protected]>
1 parent 646a211 commit 91ff704

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ var start = Date.now();
1212
var err;
1313
var caught = false;
1414

15+
// Verify that stderr is not accessed when a bad shell is used
16+
assert.throws(
17+
function() { execSync('exit -1', {shell: 'bad_shell'}); },
18+
/spawnSync bad_shell ENOENT/,
19+
'execSync did not throw the expected exception!'
20+
);
21+
assert.throws(
22+
function() { execFileSync('exit -1', {shell: 'bad_shell'}); },
23+
/spawnSync bad_shell ENOENT/,
24+
'execFileSync did not throw the expected exception!'
25+
);
26+
1527
try {
1628
var cmd = `"${process.execPath}" -e "setTimeout(function(){}, ${SLEEP});"`;
1729
var ret = execSync(cmd, {timeout: TIMER});

0 commit comments

Comments
 (0)