-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes a regression from 5759722 that prevented modules from being preloaded if the cwd does not exist. Absolute and builtin modules now preload correctly again.
- Loading branch information
Showing
2 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const fs = require('fs'); | ||
const spawn = require('child_process').spawn; | ||
|
||
// Fails with EINVAL on SmartOS, EBUSY on Windows. | ||
if (process.platform === 'sunos' || common.isWindows) { | ||
console.log('1..0 # Skipped: cannot rmdir current working directory'); | ||
return; | ||
} | ||
|
||
const dirname = common.tmpDir + '/cwd-does-not-exist-' + process.pid; | ||
const abspathFile = require('path').join(common.fixturesDir, 'a.js'); | ||
common.refreshTmpDir(); | ||
fs.mkdirSync(dirname); | ||
process.chdir(dirname); | ||
fs.rmdirSync(dirname); | ||
|
||
|
||
const proc = spawn(process.execPath, ['-r', abspathFile, '-e', '0']); | ||
proc.stdout.pipe(process.stdout); | ||
proc.stderr.pipe(process.stderr); | ||
|
||
proc.once('exit', common.mustCall(function(exitCode, signalCode) { | ||
assert.strictEqual(exitCode, 0); | ||
assert.strictEqual(signalCode, null); | ||
})); |