MCPcopy Index your code
hub / github.com/angular/angular-cli / killProcess

Function killProcess

tests/e2e/utils/process.ts:263–280  ·  view source on GitHub ↗

* Kills a process by PID * @param pid The PID of the process to kill * @param signal The signal to send to the process

(pid: number, signal: NodeJS.Signals)

Source from the content-addressed store, hash-verified

261 * @param signal The signal to send to the process
262 */
263async function killProcess(pid: number, signal: NodeJS.Signals): Promise<void> {
264 if (process.platform === 'win32') {
265 // /T kills child processes, /F forces it
266 await new Promise<void>((resolve) => {
267 child_process.exec(`taskkill /pid ${pid} /T /F`, () => resolve());
268 });
269 } else {
270 // Use -pid to signal the entire process group
271 try {
272 process.kill(-pid, signal);
273 } catch (error) {
274 assertIsError(error);
275 if (error.code !== 'ESRCH') {
276 throw error;
277 }
278 }
279 }
280}
281
282/**
283 * Kills all tracked processes

Callers 1

killAllProcessesFunction · 0.85

Calls 2

assertIsErrorFunction · 0.90
resolveFunction · 0.50

Tested by

no test coverage detected