* A child process which ends the given way instead of ever returning a result
(code: number | null, signal: string | null)
| 23 | * A child process which ends the given way instead of ever returning a result |
| 24 | */ |
| 25 | function dyingProcess(code: number | null, signal: string | null) { |
| 26 | const scriptProc = new EventEmitter() as any; |
| 27 | scriptProc.connected = false; |
| 28 | scriptProc.exitCode = code; |
| 29 | scriptProc.kill = () => {}; |
| 30 | // a real child process cannot exit in the same tick as the message we send to it |
| 31 | scriptProc.send = () => setImmediate(() => scriptProc.emit('exit', code, signal)); |
| 32 | return scriptProc; |
| 33 | } |
| 34 | |
| 35 | async function runScript(scriptProc: any, timeoutMs: number, serverHost?: string) { |
| 36 | const originalFork = cp.fork; |