Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTimothy J Fontaine <tjfontaine@gmail.com>2014-02-18 04:29:23 +0400
committerFedor Indutny <fedor.indutny@gmail.com>2014-02-18 16:03:13 +0400
commit937e2e351b2450cf1e9c4d8b3e1a4e2a2def58bb (patch)
treeffa883513db02314a16e2c5267029504cd5e90c7 /test
parent59baab277691dcc7d788724020084414b96de22c (diff)
child_process: execFileSync stderr should inherit
If you don't set your options.stdio for execSync and execFileSync capture and write to stderr of the parent process by default. Fixes #7110
Diffstat (limited to 'test')
-rw-r--r--test/common.js5
-rw-r--r--test/simple/test-child-process-spawnsync-input.js17
2 files changed, 11 insertions, 11 deletions
diff --git a/test/common.js b/test/common.js
index d44f0ea1103..40f70728327 100644
--- a/test/common.js
+++ b/test/common.js
@@ -214,3 +214,8 @@ exports.mustCall = function(fn, expected) {
return fn.apply(this, arguments);
};
};
+
+exports.checkSpawnSyncRet = function(ret) {
+ assert.strictEqual(ret.status, 0);
+ assert.strictEqual(ret.error, undefined);
+};
diff --git a/test/simple/test-child-process-spawnsync-input.js b/test/simple/test-child-process-spawnsync-input.js
index 2bcf043f80a..66b2fa354ae 100644
--- a/test/simple/test-child-process-spawnsync-input.js
+++ b/test/simple/test-child-process-spawnsync-input.js
@@ -26,11 +26,6 @@ var util = require('util');
var spawnSync = require('child_process').spawnSync;
-function checkRet(ret) {
- assert.strictEqual(ret.status, 0);
- assert.strictEqual(ret.error, undefined);
-}
-
var msgOut = 'this is stdout';
var msgErr = 'this is stderr';
@@ -50,13 +45,13 @@ if (process.argv.indexOf('spawnchild') !== -1) {
switch (process.argv[3]) {
case '1':
ret = spawnSync(process.execPath, args, { stdio: 'inherit' });
- checkRet(ret);
+ common.checkSpawnSyncRet(ret);
break;
case '2':
ret = spawnSync(process.execPath, args, {
stdio: ['inherit', 'inherit', 'inherit']
});
- checkRet(ret);
+ common.checkSpawnSyncRet(ret);
break;
}
process.exit(0);
@@ -65,7 +60,7 @@ if (process.argv.indexOf('spawnchild') !== -1) {
function verifyBufOutput(ret) {
- checkRet(ret);
+ common.checkSpawnSyncRet(ret);
assert.deepEqual(ret.stdout, msgOutBuf);
assert.deepEqual(ret.stderr, msgErrBuf);
}
@@ -89,7 +84,7 @@ options = {
ret = spawnSync('cat', [], options);
-checkRet(ret);
+common.checkSpawnSyncRet(ret);
assert.strictEqual(ret.stdout.toString('utf8'), options.input);
assert.strictEqual(ret.stderr.toString('utf8'), '');
@@ -99,7 +94,7 @@ options = {
ret = spawnSync('cat', [], options);
-checkRet(ret);
+common.checkSpawnSyncRet(ret);
assert.deepEqual(ret.stdout, options.input);
assert.deepEqual(ret.stderr, new Buffer(''));
@@ -107,7 +102,7 @@ verifyBufOutput(spawnSync(process.execPath, args));
ret = spawnSync(process.execPath, args, { encoding: 'utf8' });
-checkRet(ret);
+common.checkSpawnSyncRet(ret);
assert.strictEqual(ret.stdout, msgOut + '\n');
assert.strictEqual(ret.stderr, msgErr + '\n');