Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
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 <robert.chiras@intel.com>
  • Loading branch information
robertchiras committed Jul 19, 2016
commit 91ff704484873390bcebabacaa97ecf16d09f84a
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