Skip to content

Commit

Permalink
Update argv0 test to verify correct behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Feb 28, 2012
1 parent 493a6bb commit 29463cb
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions test/simple/test-process-argv-0.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,24 @@ 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('node', [__filename, "child"], {
cwd: common.tmpDir,
env: util._extend({ PATH: path.dirname(process.execPath) }, process.env)
var child = spawn('./node', [__filename, "child"], {
cwd: path.dirname(process.execPath)
});

var childArgv0 = '';
child.stdout.on('data', function (chunk) {
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: '));
assert.equal(childArgv0, process.execPath);
});
}
Expand Down

0 comments on commit 29463cb

Please sign in to comment.