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 899d5a906683e8967746e10a6de452e99e236903..4c459b58b5a048d9d8a4f15f4011e7cce68089f4 100644
--- a/lib/internal/bootstrap/pre_execution.js
+++ b/lib/internal/bootstrap/pre_execution.js
@@ -563,6 +563,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 110a3ed1637b642b1d83fb36549cced151b9c5cd..50da62d11bf87c333322264f26e5b427efc7d46b 100644
--- a/lib/internal/main/worker_thread.js
+++ b/lib/internal/main/worker_thread.js
@@ -29,6 +29,7 @@ const {
   initializeReport,
   initializeSourceMapsHandlers,
   loadPreloadModules,
+  setupAsarSupport,
   setupTraceCategoryState
 } = require('internal/bootstrap/pre_execution');
 
@@ -158,6 +159,8 @@ port.on('message', (message) => {
     };
     workerIo.sharedCwdCounter = cwdCounter;
 
+    setupAsarSupport();
+
     const CJSLoader = require('internal/modules/cjs/loader');
     assert(!CJSLoader.hasLoadedAnyUserCJSModule);
     loadPreloadModules();
