mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
575 B
26 lines
575 B
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
var child_process = require('child_process');
|
|
|
|
function test(fun, code) {
|
|
var errors = 0;
|
|
|
|
fun('does-not-exist', function(err) {
|
|
assert.equal(err.code, code);
|
|
assert(/does\-not\-exist/.test(err.cmd));
|
|
errors++;
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(errors, 1);
|
|
});
|
|
}
|
|
|
|
if (common.isWindows) {
|
|
test(child_process.exec, 1); // exit code of cmd.exe
|
|
} else {
|
|
test(child_process.exec, 127); // exit code of /bin/sh
|
|
}
|
|
|
|
test(child_process.execFile, 'ENOENT');
|
|
|