• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3const assert = require('assert');
4const cp = require('child_process');
5const os = require('os');
6const path = require('path');
7
8
9if (process.argv[2] === 'child') {
10  if (common.isWindows)
11    assert.strictEqual(process.env.USERPROFILE, undefined);
12  else
13    assert.strictEqual(process.env.HOME, undefined);
14
15  const home = os.homedir();
16
17  assert.strictEqual(typeof home, 'string');
18  assert(home.includes(path.sep));
19} else {
20  if (common.isWindows)
21    delete process.env.USERPROFILE;
22  else
23    delete process.env.HOME;
24
25  const child = cp.spawnSync(process.execPath, [__filename, 'child'], {
26    env: process.env
27  });
28
29  assert.strictEqual(child.status, 0);
30}
31