fixed undoPatch

This commit is contained in:
Igor Klopov 2016-09-09 19:28:52 +03:00
parent ac2ae8c104
commit da337264f1

View File

@ -348,7 +348,7 @@
--- node/src/node_javascript.cc
+++ node/src/node_javascript.cc
@@ -31,8 +31,46 @@
@@ -31,8 +31,47 @@
env->isolate(), reinterpret_cast<const char*>(native.source),
NewStringType::kNormal, native.source_len).ToLocalChecked();
target->Set(name, source);
@ -366,6 +366,7 @@
+ " // when THIS array (mb?) found as plain bytes\n" \
+ " var start = me.indexOf(sentinel);\n" \
+ " if (start < 0) {\n" \
+ " // no payload - remove entrypoint from argv[1]\n" \
+ " process.argv.splice(1, 1);\n" \
+ " return undefined;\n" \
+ " }\n" \
@ -385,7 +386,7 @@
+ "}\n" \
+ "\n" \
+ "var r = readOverlay();\n" \
+ "if (r && r.undoPatch) {\n" \
+ "if (!r || r.undoPatch) {\n" \
+ " // fallback to plain node. need to revert patch to node/lib/module.js\n" \
+ " require('fs').internalModuleStat = process.binding('fs').internalModuleStat;\n" \
+ " require('fs').internalModuleReadFile = process.binding('fs').internalModuleReadFile;\n" \