From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Fedor Indutny <indutny@signal.org>
Date: Wed, 9 Mar 2022 17:52:32 -0800
Subject: worker_thread: add asar support

This patch initializes asar support in workers threads in
Node.js.

diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js
index 2af6b11c97ecdca3c40792ab35c69b07b9db76a0..e79ce2b79a5f88a315ac013b6e12534ba1531d6b 100644
--- a/lib/internal/bootstrap/pre_execution.js
+++ b/lib/internal/bootstrap/pre_execution.js
@@ -498,6 +498,7 @@ module.exports = {
   loadPreloadModules,
   setupTraceCategoryState,
   setupInspectorHooks,
+  setupAsarSupport,
   initializeReport,
   initializeCJSLoader,
   initializeWASI
diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js
index 2e5d6b01d86e34549c1c7a3d3128350cad2b0c47..74ab84ca39a01269925ca0e326e4aa8894fce8a1 100644
--- a/lib/internal/main/worker_thread.js
+++ b/lib/internal/main/worker_thread.js
@@ -27,6 +27,7 @@ const {
   initializeReport,
   initializeSourceMapsHandlers,
   loadPreloadModules,
+  setupAsarSupport,
   setupTraceCategoryState
 } = require('internal/bootstrap/pre_execution');
 
@@ -154,6 +155,8 @@ port.on('message', (message) => {
     };
     workerIo.sharedCwdCounter = cwdCounter;
 
+    setupAsarSupport();
+
     const CJSLoader = require('internal/modules/cjs/loader');
     assert(!CJSLoader.hasLoadedAnyUserCJSModule);
     loadPreloadModules();
