Files
node/test/parallel/test-process-execpath.js
Junsoo Ha f7968e73ee test: use common/child_process spawnSync helpers
Replace manual spawnSync() result assertions
with test/common/child_process helper functions.

Signed-off-by: Junsoo Ha <junsoo2018@naver.com>
PR-URL: https://github.com/nodejs/node/pull/65377
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2026-08-21 13:40:07 +00:00

27 lines
755 B
JavaScript

'use strict';
const common = require('../common');
if (common.isWindows)
common.skip('symlinks are weird on windows');
const assert = require('assert');
const { spawnSyncAndAssert } = require('../common/child_process');
const fs = require('fs');
assert.strictEqual(process.execPath, fs.realpathSync(process.execPath));
if (process.argv[2] === 'child') {
// The console.log() output is part of the test here.
console.log(process.execPath);
} else {
const tmpdir = require('../common/tmpdir');
tmpdir.refresh();
const symlinkedNode = tmpdir.resolve('symlinked-node');
fs.symlinkSync(process.execPath, symlinkedNode);
spawnSyncAndAssert(symlinkedNode, [__filename, 'child'], {
stdout: `${process.execPath}\n`,
stderr: ''
});
}