mirror of https://github.com/lukechilds/node.git
Browse Source
os.homedir() calls libuv's uv_os_homedir() to retrieve the current user's home directory. PR-URL: https://github.com/nodejs/io.js/pull/1791 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rod Vagg <rod@vagg.org>v2.3.1-release
cjihrig
10 years ago
6 changed files with 79 additions and 1 deletions
@ -0,0 +1,30 @@ |
|||
'use strict'; |
|||
var common = require('../common'); |
|||
var assert = require('assert'); |
|||
var cp = require('child_process'); |
|||
var os = require('os'); |
|||
var path = require('path'); |
|||
|
|||
|
|||
if (process.argv[2] === 'child') { |
|||
if (common.isWindows) |
|||
assert.equal(process.env.USERPROFILE, undefined); |
|||
else |
|||
assert.equal(process.env.HOME, undefined); |
|||
|
|||
var home = os.homedir(); |
|||
|
|||
assert.ok(typeof home === 'string'); |
|||
assert.ok(home.indexOf(path.sep) !== -1); |
|||
} else { |
|||
if (common.isWindows) |
|||
delete process.env.USERPROFILE; |
|||
else |
|||
delete process.env.HOME; |
|||
|
|||
var child = cp.spawnSync(process.execPath, [__filename, 'child'], { |
|||
env: process.env |
|||
}); |
|||
|
|||
assert.equal(child.status, 0); |
|||
} |
Loading…
Reference in new issue