Skip to content

Commit 29463cb

Browse files
committed
Update argv0 test to verify correct behavior
1 parent 493a6bb commit 29463cb

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test/simple/test-process-argv-0.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,24 @@ var assert = require('assert');
2424
var spawn = require('child_process').spawn;
2525
var common = require('../common');
2626

27+
console.error('argv=%j', process.argv);
28+
console.error('exec=%j', process.execPath);
29+
2730
if (process.argv[2] !== "child") {
28-
var child = spawn('node', [__filename, "child"], {
29-
cwd: common.tmpDir,
30-
env: util._extend({ PATH: path.dirname(process.execPath) }, process.env)
31+
var child = spawn('./node', [__filename, "child"], {
32+
cwd: path.dirname(process.execPath)
3133
});
3234

3335
var childArgv0 = '';
34-
child.stdout.on('data', function (chunk) {
36+
var childErr = '';
37+
child.stdout.on('data', function(chunk) {
3538
childArgv0 += chunk;
3639
});
40+
child.stderr.on('data', function(chunk) {
41+
childErr += chunk;
42+
});
3743
child.on('exit', function () {
44+
console.error('CHILD: %s', childErr.trim().split('\n').join('\nCHILD: '));
3845
assert.equal(childArgv0, process.execPath);
3946
});
4047
}

0 commit comments

Comments
 (0)