()
| 221 | |
| 222 | for (const signal of terminationSignals) { |
| 223 | const handler = () => { |
| 224 | if ( |
| 225 | !managePosixProcessGroup && |
| 226 | (child.exitCode !== null || child.signalCode !== null) |
| 227 | ) { |
| 228 | return; |
| 229 | } |
| 230 | |
| 231 | forwardedSignal = signal; |
| 232 | const terminationPromise = terminateProcessTree |
| 233 | ? process.platform === "win32" |
| 234 | ? terminateWindowsProcessTree(child, signal) |
| 235 | : terminatePosixProcessGroup(child, signal) |
| 236 | : Promise.resolve(child.kill(signal)); |
| 237 | terminationPromises.push(terminationPromise); |
| 238 | // The child may take longer to exit than the termination command takes to |
| 239 | // fail. Attach a handler now and rethrow when both operations are awaited. |
| 240 | void terminationPromise.catch(() => {}); |
| 241 | }; |
| 242 | |
| 243 | signalHandlers.set(signal, handler); |
| 244 | process.on(signal, handler); |
nothing calls this directly
no test coverage detected