mirror of
https://github.com/nodejs/node.git
synced 2025-05-04 23:42:17 +00:00

In the tests, we use "process.platform === 'win32'" in some places. This patch replaces them with the "common.isWindows" for consistency. PR-URL: https://github.com/nodejs/io.js/pull/2269 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
27 lines
575 B
JavaScript
27 lines
575 B
JavaScript
'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');
|