2016-10-21 22:57:17 +02:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
2017-07-01 02:29:09 +03:00
|
|
|
if (common.isWindows)
|
|
|
|
common.skip('symlinks are weird on windows');
|
|
|
|
|
2016-10-21 22:57:17 +02:00
|
|
|
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 {
|
2017-12-24 22:38:11 -08:00
|
|
|
const tmpdir = require('../common/tmpdir');
|
|
|
|
tmpdir.refresh();
|
2016-10-21 22:57:17 +02:00
|
|
|
|
2023-08-15 22:45:44 +09:00
|
|
|
const symlinkedNode = tmpdir.resolve('symlinked-node');
|
2016-10-21 22:57:17 +02:00
|
|
|
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);
|
|
|
|
}
|