mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 12:03:30 +00:00

PR-URL: https://github.com/nodejs/node/pull/14162 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
19 lines
628 B
JavaScript
19 lines
628 B
JavaScript
'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');
|