feat_initialize_asar_support.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Shelley Vohr <[email protected]>
  3. Date: Thu, 13 Sep 2018 08:56:07 -0700
  4. Subject: feat: initialize asar support
  5. This patch initializes asar support in Node.js.
  6. diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
  7. index 1f4a08515b5ae9e15ee987d9287f71b0fed3cb30..0dc769846b4e6fe84438cd6d8024c4a89eb90a9b 100644
  8. --- a/lib/internal/process/pre_execution.js
  9. +++ b/lib/internal/process/pre_execution.js
  10. @@ -67,6 +67,8 @@ function prepareWorkerThreadExecution() {
  11. });
  12. }
  13. +
  14. +let processLinkedBinding = process._linkedBinding;
  15. function prepareExecution(options) {
  16. const { expandArgv1, initializeModules, isMainThread } = options;
  17. @@ -170,12 +172,17 @@ function setupUserModules(isLoaderWorker = false) {
  18. loadPreloadModules();
  19. // Need to be done after --require setup.
  20. initializeFrozenIntrinsics();
  21. + setupAsarSupport();
  22. }
  23. function refreshRuntimeOptions() {
  24. refreshOptions();
  25. }
  26. +function setupAsarSupport() {
  27. + processLinkedBinding('electron_common_asar').initAsarSupport(require);
  28. +}
  29. +
  30. function patchProcessObject(expandArgv1) {
  31. const binding = internalBinding('process_methods');
  32. binding.patchProcessObject(process);