• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3if (common.isWindows)
4  common.skip('symlinks are weird on windows');
5
6const assert = require('assert');
7const child_process = require('child_process');
8const path = require('path');
9const fs = require('fs');
10
11assert.strictEqual(process.execPath, fs.realpathSync(process.execPath));
12
13if (process.argv[2] === 'child') {
14  // The console.log() output is part of the test here.
15  console.log(process.execPath);
16} else {
17  const tmpdir = require('../common/tmpdir');
18  tmpdir.refresh();
19
20  const symlinkedNode = path.join(tmpdir.path, 'symlinked-node');
21  fs.symlinkSync(process.execPath, symlinkedNode);
22
23  const proc = child_process.spawnSync(symlinkedNode, [__filename, 'child']);
24  assert.strictEqual(proc.stderr.toString(), '');
25  assert.strictEqual(proc.stdout.toString(), `${process.execPath}\n`);
26  assert.strictEqual(proc.status, 0);
27}
28