node/test/parallel/test-process-exec-argv.js
Santiago Gimeno dffafde7f1 test: fix test-process-exec-argv flakiness
Wait for the `close` event before parsing the child stdout output.

Fixes: https://github.com/nodejs/node/issues/6480
PR-URL: https://github.com/nodejs/node/pull/6575
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2016-05-12 18:42:57 +02:00

22 lines
563 B
JavaScript

'use strict';
require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;
if (process.argv[2] === 'child') {
process.stdout.write(JSON.stringify(process.execArgv));
} else {
var execArgv = ['--harmony_proxies', '--stack-size=256'];
var args = [__filename, 'child', 'arg0'];
var child = spawn(process.execPath, execArgv.concat(args));
var out = '';
child.stdout.on('data', function(chunk) {
out += chunk;
});
child.on('close', function() {
assert.deepStrictEqual(JSON.parse(out), execArgv);
});
}