mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
966e3d3493
PR-URL: https://github.com/nodejs/node/pull/49128 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
27 lines
854 B
JavaScript
27 lines
854 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
if (common.isWindows)
|
|
common.skip('symlinks are weird on windows');
|
|
|
|
const assert = require('assert');
|
|
const child_process = require('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);
|
|
|
|
const proc = child_process.spawnSync(symlinkedNode, [__filename, 'child']);
|
|
assert.strictEqual(proc.stderr.toString(), '');
|
|
assert.strictEqual(proc.stdout.toString(), `${process.execPath}\n`);
|
|
assert.strictEqual(proc.status, 0);
|
|
}
|