mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
052434a0c1
PR-URL: https://github.com/nodejs/node/pull/49136 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
26 lines
695 B
JavaScript
26 lines
695 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const path = require('path');
|
|
const { spawn } = require('child_process');
|
|
const tmpdir = require('../common/tmpdir');
|
|
const fs = require('fs');
|
|
tmpdir.refresh();
|
|
|
|
const realPath = path.resolve(__dirname, '../fixtures/es-modules/symlink.mjs');
|
|
const symlinkPath = tmpdir.resolve('symlink.mjs');
|
|
|
|
try {
|
|
fs.symlinkSync(realPath, symlinkPath);
|
|
} catch (err) {
|
|
if (err.code !== 'EPERM') throw err;
|
|
common.skip('insufficient privileges for symlinks');
|
|
}
|
|
|
|
spawn(process.execPath,
|
|
['--preserve-symlinks', symlinkPath],
|
|
{ stdio: 'inherit' }).on('exit', (code) => {
|
|
assert.strictEqual(code, 0);
|
|
});
|