| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 989a2a1 commit 432cb35
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,6 +27,7 @@ exports.isSunOS = process.platform === 'sunos'; | |||
| 27 | 27 | exports.isFreeBSD = process.platform === 'freebsd'; | |
| 28 | 28 | ||
| 29 | 29 | exports.enoughTestMem = os.totalmem() > 0x20000000; /* 512MB */ | |
| 30 | + exports.rootDir = exports.isWindows ? 'c:\\' : '/'; | ||
| 30 | 31 | ||
| 31 | 32 | function rimrafSync(p) { | |
| 32 | 33 | try { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,12 +36,11 @@ function testCwd(options, forCode, forData) { | |||
| 36 | 36 | } | |
| 37 | 37 | ||
| 38 | 38 | // Assume these exist, and 'pwd' gives us the right directory back | |
| 39 | + testCwd({cwd: common.rootDir}, 0, common.rootDir); | ||
| 39 | 40 | if (common.isWindows) { | |
| 40 | 41 | testCwd({cwd: process.env.windir}, 0, process.env.windir); | |
| 41 | - testCwd({cwd: 'c:\\'}, 0, 'c:\\'); | ||
| 42 | 42 | } else { | |
| 43 | 43 | testCwd({cwd: '/dev'}, 0, '/dev'); | |
| 44 | - testCwd({cwd: '/'}, 0, '/'); | ||
| 45 | 44 | } | |
| 46 | 45 | ||
| 47 | 46 | // Assume does-not-exist doesn't exist, expect exitCode=-1 and errno=ENOENT | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,7 +20,7 @@ assert.deepStrictEqual(ret_err.spawnargs, ['bar']); | |||
| 20 | 20 | ||
| 21 | 21 | { | |
| 22 | 22 | // Test the cwd option | |
| 23 | - const cwd = common.isWindows ? 'c:\\' : '/'; | ||
| 23 | + const cwd = common.rootDir; | ||
| 24 | 24 | const response = common.spawnSyncPwd({cwd}); | |
| 25 | 25 | ||
| 26 | 26 | assert.strictEqual(response.stdout.toString().trim(), cwd); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,20 +61,13 @@ assert.strictEqual(ret, msg + '\n', | |||
| 61 | 61 | 'execFileSync encoding result should match'); | |
| 62 | 62 | ||
| 63 | 63 | // Verify that the cwd option works - GH #7824 | |
| 64 | - (function() { | ||
| 65 | - var response; | ||
| 66 | - var cwd; | ||
| 67 | - | ||
| 68 | - if (common.isWindows) { | ||
| 69 | - cwd = 'c:\\'; | ||
| 70 | - response = execSync('echo %cd%', {cwd: cwd}); | ||
| 71 | - } else { | ||
| 72 | - cwd = '/'; | ||
| 73 | - response = execSync('pwd', {cwd: cwd}); | ||
| 74 | - } | ||
| 64 | + { | ||
| 65 | + const cwd = common.rootDir; | ||
| 66 | + const cmd = common.isWindows ? 'echo %cd%' : 'pwd'; | ||
| 67 | + const response = execSync(cmd, {cwd}); | ||
| 75 | 68 | ||
| 76 | 69 | assert.strictEqual(response.toString().trim(), cwd); | |
| 77 | - })(); | ||
| 70 | + } | ||
| 78 | 71 | ||
| 79 | 72 | // Verify that stderr is not accessed when stdio = 'ignore' - GH #7966 | |
| 80 | 73 | (function() { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments