mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
626 B
19 lines
626 B
9 years ago
|
'use strict';
|
||
|
require('../common');
|
||
|
const assert = require('assert');
|
||
|
const cp = require('child_process');
|
||
|
|
||
|
// This test spawns itself with an argument to indicate when it is a child to
|
||
|
// easily and portably print the value of argv[0]
|
||
|
if (process.argv[2] === 'child') {
|
||
|
console.log(process.argv0);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
const noArgv0 = cp.spawnSync(process.execPath, [__filename, 'child']);
|
||
|
assert.strictEqual(noArgv0.stdout.toString().trim(), process.execPath);
|
||
|
|
||
|
const withArgv0 = cp.spawnSync(process.execPath, [__filename, 'child'],
|
||
|
{argv0: 'withArgv0'});
|
||
|
assert.strictEqual(withArgv0.stdout.toString().trim(), 'withArgv0');
|