• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4const assert = require('assert');
5const path = require('path');
6const { spawn } = require('child_process');
7const tmpdir = require('../common/tmpdir');
8const fs = require('fs');
9tmpdir.refresh();
10
11const realPath = path.resolve(__dirname, '../fixtures/es-modules/symlink.mjs');
12const symlinkPath = path.resolve(tmpdir.path, 'symlink.mjs');
13
14try {
15  fs.symlinkSync(realPath, symlinkPath);
16} catch (err) {
17  if (err.code !== 'EPERM') throw err;
18  common.skip('insufficient privileges for symlinks');
19}
20
21spawn(process.execPath,
22      ['--preserve-symlinks', symlinkPath],
23      { stdio: 'inherit' }).on('exit', (code) => {
24  assert.strictEqual(code, 0);
25});
26