forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: don't use fopen() in require() fast path
Fix a regression that was introduced in commit 1bbf8d0 ("lib: speed up require(), phase 2") where file paths with Unicode characters fail to load on Windows. Fixes: nodejs#2236 PR-URL: nodejs#2377 Reviewed-By: Bert Belder <[email protected]>
- Loading branch information
1 parent
4c06515
commit a593cb7
Showing
2 changed files
with
40 additions
and
7 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,16 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
common.refreshTmpDir(); | ||
|
||
const dirname = path.join(common.tmpDir, '\u4e2d\u6587\u76ee\u5f55'); | ||
fs.mkdirSync(dirname); | ||
fs.writeFileSync(path.join(dirname, 'file.js'), 'module.exports = 42;'); | ||
fs.writeFileSync(path.join(dirname, 'package.json'), | ||
JSON.stringify({ name: 'test', main: 'file.js' })); | ||
assert.equal(require(dirname), 42); | ||
assert.equal(require(path.join(dirname, 'file.js')), 42); |