From 972a57cb20ae7e9794e61d505ae334cb1e2b45a6 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 25 Aug 2015 09:18:25 -0700 Subject: [PATCH] test: make test-process-argv-0 robust MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- test/parallel/test-process-argv-0.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/test/parallel/test-process-argv-0.js b/test/parallel/test-process-argv-0.js index b67601a2556fee..fb6df310e14661 100644 --- a/test/parallel/test-process-argv-0.js +++ b/test/parallel/test-process-argv-0.js @@ -1,12 +1,7 @@ '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'], { @@ -14,15 +9,10 @@ if (process.argv[2] !== 'child') { }); 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); }); }