MCPcopy Create free account
hub / github.com/code-forge-io/Remix-Forge / killtree

Function killtree

src/devTools/killProcess.ts:33–53  ·  view source on GitHub ↗
(pid: number)

Source from the content-addressed store, hash-verified

31};
32
33export const killtree = async (pid: number) => {
34 let descendants = await pidtree(pid);
35 let pids = [pid, ...descendants];
36
37 await Promise.all(pids.map(kill));
38
39 return new Promise<void>((resolve, reject) => {
40 let check = setInterval(() => {
41 pids = pids.filter(isAlive);
42 if (pids.length === 0) {
43 clearInterval(check);
44 resolve();
45 }
46 }, 50);
47
48 setTimeout(() => {
49 clearInterval(check);
50 reject(new Error("Timeout: Processes did not exit within the specified time."));
51 }, 2000);
52 });
53};

Callers 2

startDevToolsFunction · 0.90
executeCommandFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected