electron/patches/node/feat_initialize_asar_suppor...

38 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Thu, 13 Sep 2018 08:56:07 -0700
Subject: feat: initialize asar support
This patch initializes asar support in Node.js.
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
index 9142fed75e9050fcc17c01208e82f1bc57923fcd..fc8f61ee6d30cf18951ec7a5eb5f09a9583a85ae 100644
--- a/lib/internal/process/pre_execution.js
+++ b/lib/internal/process/pre_execution.js
@@ -87,6 +87,7 @@ function prepareShadowRealmExecution() {
});
}
+let processLinkedBinding = process._linkedBinding;
function prepareExecution(options) {
const { expandArgv1, initializeModules, isMainThread } = options;
@@ -193,12 +194,17 @@ function setupUserModules(forceDefaultLoader = false) {
}
// Need to be done after --require setup.
initializeFrozenIntrinsics();
+ setupAsarSupport();
}
function refreshRuntimeOptions() {
refreshOptions();
}
+function setupAsarSupport() {
+ processLinkedBinding('electron_common_asar').initAsarSupport(require);
+}
+
/**
* Patch the process object with legacy properties and normalizations.
* Replace `process.argv[0]` with `process.execPath`, preserving the original `argv[0]` value as `process.argv0`.