11import type { SandboxedOptions } from '../interfaces'
22import * as path from 'node:path'
3+ import process from 'node:process'
34import { Child } from './child'
45
56const CHILD_KILL_TIMEOUT = 30_000
@@ -31,11 +32,11 @@ export class ChildPool {
3132 let child = this . getFree ( processFile ) . pop ( )
3233
3334 if ( child ) {
34- this . retained [ child . pid ] = child
35+ this . retained [ child . pid as number ] = child
3536 return child
3637 }
3738
38- child = new Child ( this . opts . mainFile , processFile , {
39+ child = new Child ( this . opts . mainFile ! , processFile , {
3940 useWorkerThreads : this . opts . useWorkerThreads ,
4041 workerForkOptions : this . opts . workerForkOptions ,
4142 workerThreadsOptions : this . opts . workerThreadsOptions ,
@@ -52,7 +53,7 @@ export class ChildPool {
5253 throw new Error ( 'Child exited before it could be retained' )
5354 }
5455
55- this . retained [ child . pid ] = child
56+ this . retained [ child . pid as number ] = child
5657
5758 return child
5859 }
@@ -64,12 +65,12 @@ export class ChildPool {
6465 }
6566
6667 release ( child : Child ) : void {
67- delete this . retained [ child . pid ]
68+ delete this . retained [ child . pid as number ]
6869 this . getFree ( child . processFile ) . push ( child )
6970 }
7071
7172 remove ( child : Child ) : void {
72- delete this . retained [ child . pid ]
73+ delete this . retained [ child . pid as number ]
7374
7475 const free = this . getFree ( child . processFile )
7576
0 commit comments