mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 18:25:13 +08:00
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>
27 lines
755 B
JavaScript
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: ''
|
|
});
|
|
}
|