From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Shelley Vohr 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 917ba90a1c8bbbff5d86e5f2079d1ce67237280e..66dfd7c1e521f38691e4656ac7ab0572a2fe75da 100644 --- a/lib/internal/process/pre_execution.js +++ b/lib/internal/process/pre_execution.js @@ -67,6 +67,8 @@ function prepareWorkerThreadExecution() { }); } + +let processLinkedBinding = process._linkedBinding; function prepareExecution(options) { const { expandArgv1, initializeModules, isMainThread } = options; @@ -172,12 +174,17 @@ function setupUserModules(isLoaderWorker = false) { loadPreloadModules(); // 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`.