fix a bug with internalModuleStat for 4.8.3
This commit is contained in:
parent
5ae8e884e5
commit
f4705d99f4
@ -84,7 +84,7 @@
|
||||
static unsigned supported_;
|
||||
--- node/deps/v8/src/parser.cc
|
||||
+++ node/deps/v8/src/parser.cc
|
||||
@@ -5636,10 +5636,11 @@
|
||||
@@ -5640,10 +5640,11 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -184,8 +184,8 @@
|
||||
const path = require('path');
|
||||
-const internalModuleReadFile = process.binding('fs').internalModuleReadFile;
|
||||
-const internalModuleStat = process.binding('fs').internalModuleStat;
|
||||
+const internalModuleReadFile = require('fs').internalModuleReadFile;
|
||||
+const internalModuleStat = require('fs').internalModuleStat;
|
||||
+const internalModuleReadFile = function (f) { return require('fs').internalModuleReadFile(f); };
|
||||
+const internalModuleStat = function (f) { return require('fs').internalModuleStat(f); };
|
||||
|
||||
const splitRe = process.platform === 'win32' ? /[\/\\]/ : /\//;
|
||||
const isIndexRe = /^index\.\w+?$/;
|
||||
@ -279,7 +279,7 @@
|
||||
}
|
||||
--- node/src/node.js
|
||||
+++ node/src/node.js
|
||||
@@ -52,10 +52,52 @@
|
||||
@@ -52,10 +52,50 @@
|
||||
// There are various modes that Node can run in. The most common two
|
||||
// are running from a script and running the REPL - but there are a few
|
||||
// others like the debugger or running --eval arguments. Here we decide
|
||||
@ -300,7 +300,7 @@
|
||||
+ if (!PRELUDE_POSITION) {
|
||||
+ // no prelude - remove entrypoint from argv[1]
|
||||
+ process.argv.splice(1, 1);
|
||||
+ return undefined;
|
||||
+ return { undoPatch: true };
|
||||
+ }
|
||||
+ var prelude = new Buffer(PRELUDE_SIZE);
|
||||
+ var read = fs.readSync(fd, prelude, 0, PRELUDE_SIZE, PRELUDE_POSITION);
|
||||
@ -317,12 +317,10 @@
|
||||
+ var fd = fs.openSync(process.execPath, 'r');
|
||||
+ var result = readPrelude(fd);
|
||||
+ if (result && result.undoPatch) {
|
||||
+ fs.closeSync(fd);
|
||||
+ }
|
||||
+ if (!result || result.undoPatch) {
|
||||
+ var bindingFs = process.binding('fs');
|
||||
+ fs.internalModuleStat = bindingFs.internalModuleStat;
|
||||
+ fs.internalModuleReadFile = bindingFs.internalModuleReadFile;
|
||||
+ fs.closeSync(fd);
|
||||
+ }
|
||||
+ }());
|
||||
+ }());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user