test: make test-process-argv-0 robust
Remove use of STDERR to avoid test flakiness on CentOS 5. Use parent process exit event for assertion rather than child exit event. PR-URL: https://github.com/nodejs/node/pull/2541 Fixes: https://github.com/nodejs/node/issues/2477 Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
This commit is contained in:
parent
c95ca0ba5b
commit
972a57cb20
@ -1,12 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var util = require('util');
|
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
var common = require('../common');
|
|
||||||
|
|
||||||
console.error('argv=%j', process.argv);
|
|
||||||
console.error('exec=%j', process.execPath);
|
|
||||||
|
|
||||||
if (process.argv[2] !== 'child') {
|
if (process.argv[2] !== 'child') {
|
||||||
var child = spawn(process.execPath, [__filename, 'child'], {
|
var child = spawn(process.execPath, [__filename, 'child'], {
|
||||||
@ -14,15 +9,10 @@ if (process.argv[2] !== 'child') {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var childArgv0 = '';
|
var childArgv0 = '';
|
||||||
var childErr = '';
|
|
||||||
child.stdout.on('data', function(chunk) {
|
child.stdout.on('data', function(chunk) {
|
||||||
childArgv0 += chunk;
|
childArgv0 += chunk;
|
||||||
});
|
});
|
||||||
child.stderr.on('data', function(chunk) {
|
process.on('exit', function() {
|
||||||
childErr += chunk;
|
|
||||||
});
|
|
||||||
child.on('exit', function() {
|
|
||||||
console.error('CHILD: %s', childErr.trim().split('\n').join('\nCHILD: '));
|
|
||||||
assert.equal(childArgv0, process.execPath);
|
assert.equal(childArgv0, process.execPath);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user