11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciif (require.main !== module) { 41cb0ef41Sopenharmony_ci const { spawnSync } = require('child_process'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ci function runModuleAs(filename, flags, spawnOptions, role) { 71cb0ef41Sopenharmony_ci return spawnSync(process.execPath, 81cb0ef41Sopenharmony_ci [...flags, __filename, role, filename], spawnOptions); 91cb0ef41Sopenharmony_ci } 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci module.exports = runModuleAs; 121cb0ef41Sopenharmony_ci return; 131cb0ef41Sopenharmony_ci} 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ciconst { Worker, isMainThread, workerData } = require('worker_threads'); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ciif (isMainThread) { 181cb0ef41Sopenharmony_ci if (process.argv[2] === 'worker') { 191cb0ef41Sopenharmony_ci new Worker(__filename, { 201cb0ef41Sopenharmony_ci workerData: process.argv[3], 211cb0ef41Sopenharmony_ci }); 221cb0ef41Sopenharmony_ci return; 231cb0ef41Sopenharmony_ci } 241cb0ef41Sopenharmony_ci require(process.argv[3]); 251cb0ef41Sopenharmony_ci} else { 261cb0ef41Sopenharmony_ci require(workerData); 271cb0ef41Sopenharmony_ci} 28