Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Update argv0 test to verify correct behavior

  • Loading branch information...
isaacs committed Feb 28, 2012
1 parent 493a6bb commit 29463cb60c2079a046f9c255fb0eccecea2674fc
Showing with 11 additions and 4 deletions.
  1. +11 −4 test/simple/test-process-argv-0.js
@@ -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);
});
}

0 comments on commit 29463cb

Please sign in to comment.
You can’t perform that action at this time.