Skip to content

Commit

Permalink
test: make test-process-argv-0 robust
Browse files Browse the repository at this point in the history
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: #2541
Fixes: #2477
Reviewed-By: Michaël Zasso <[email protected]>
  • Loading branch information
Trott authored and rvagg committed Aug 27, 2015
1 parent 13fd96d commit 3492d2d
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions test/parallel/test-process-argv-0.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
'use strict';
var util = require('util');
var path = require('path');
var assert = require('assert');
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') {
var child = spawn(process.execPath, [__filename, 'child'], {
cwd: path.dirname(process.execPath)
});

var childArgv0 = '';
var childErr = '';
child.stdout.on('data', function(chunk) {
childArgv0 += chunk;
});
child.stderr.on('data', function(chunk) {
childErr += chunk;
});
child.on('exit', function() {
console.error('CHILD: %s', childErr.trim().split('\n').join('\nCHILD: '));
process.on('exit', function() {
assert.equal(childArgv0, process.execPath);
});
}
Expand Down

0 comments on commit 3492d2d

Please sign in to comment.