node/test/parallel/test-child-process-exec-error.js
Sakthipriyan Vairamani d5ab92bcc1 test: use common.isWindows consistently
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>
2015-07-31 00:29:36 +05:30

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');