Skip to content

Commit

Permalink
test: Additional test for execSync
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
robertchiras committed Jul 19, 2016
1 parent 646a211 commit 91ff704
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/sequential/test-child-process-execsync.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ var start = Date.now();
var err;
var caught = false;

// Verify that stderr is not accessed when a bad shell is used
assert.throws(
function() { execSync('exit -1', {shell: 'bad_shell'}); },
/spawnSync bad_shell ENOENT/,
'execSync did not throw the expected exception!'
);
assert.throws(
function() { execFileSync('exit -1', {shell: 'bad_shell'}); },
/spawnSync bad_shell ENOENT/,
'execFileSync did not throw the expected exception!'
);

try {
var cmd = `"${process.execPath}" -e "setTimeout(function(){}, ${SLEEP});"`;
var ret = execSync(cmd, {timeout: TIMER});
Expand Down

0 comments on commit 91ff704

Please sign in to comment.