()
| 180 | let lastSpawned: ElectronProcess | null = null; |
| 181 | |
| 182 | const forgeSpawn = async () => { |
| 183 | let electronExecPath: string | null = null; |
| 184 | |
| 185 | // If a plugin has taken over the start command let's stop here |
| 186 | let spawnedPluginChild = |
| 187 | await forgeConfig.pluginInterface.overrideStartLogic({ |
| 188 | dir, |
| 189 | appPath, |
| 190 | interactive, |
| 191 | enableLogging, |
| 192 | args, |
| 193 | runAsNode, |
| 194 | inspect, |
| 195 | inspectBrk, |
| 196 | }); |
| 197 | if ( |
| 198 | typeof spawnedPluginChild === 'object' && |
| 199 | 'tasks' in spawnedPluginChild |
| 200 | ) { |
| 201 | const innerRunner = new Listr<never>( |
| 202 | [], |
| 203 | listrOptions as ForgeListrOptions<never>, |
| 204 | ); |
| 205 | for (const task of spawnedPluginChild.tasks) { |
| 206 | innerRunner.add(task); |
| 207 | } |
| 208 | await innerRunner.run(); |
| 209 | spawnedPluginChild = spawnedPluginChild.result; |
| 210 | } |
| 211 | let prefixArgs: string[] = []; |
| 212 | if (typeof spawnedPluginChild === 'string') { |
| 213 | electronExecPath = spawnedPluginChild; |
| 214 | } else if (Array.isArray(spawnedPluginChild)) { |
| 215 | [electronExecPath, ...prefixArgs] = spawnedPluginChild; |
| 216 | } else if (spawnedPluginChild) { |
| 217 | await runHook(forgeConfig, 'postStart', spawnedPluginChild); |
| 218 | return spawnedPluginChild; |
| 219 | } |
| 220 | |
| 221 | if (!electronExecPath) { |
| 222 | electronExecPath = await locateElectronExecutable(dir, packageJSON); |
| 223 | } |
| 224 | |
| 225 | d('Electron binary path:', electronExecPath); |
| 226 | |
| 227 | const spawnOpts = { |
| 228 | cwd: dir, |
| 229 | stdio: 'inherit', |
| 230 | env: { |
| 231 | ...process.env, |
| 232 | ...(enableLogging |
| 233 | ? { |
| 234 | ELECTRON_ENABLE_LOGGING: 'true', |
| 235 | ELECTRON_ENABLE_STACK_DUMPING: 'true', |
| 236 | } |
| 237 | : {}), |
| 238 | } as NodeJS.ProcessEnv, |
| 239 | }; |
no test coverage detected