MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / destroy

Method destroy

common/src/process_tools.ts:97–120  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

95 }
96
97 private async destroy() {
98 try {
99 for (const n of this.eventNames()) this.removeAllListeners(n);
100 if (this.process?.stdout)
101 for (const eventName of this.process.stdout.eventNames())
102 this.process.stdout.removeAllListeners(eventName);
103 if (this.process?.stderr)
104 for (const eventName of this.process.stderr.eventNames())
105 this.process.stderr.removeAllListeners(eventName);
106 if (this.process)
107 for (const eventName of this.process.eventNames())
108 this.process.removeAllListeners(eventName);
109 this.process?.stdout?.destroy();
110 this.process?.stderr?.destroy();
111 if (this.process?.exitCode === null) {
112 this.process.kill("SIGTERM");
113 this.process.kill("SIGKILL");
114 }
115 } catch (error: any) {
116 console.log("[ProcessWrapper destroy() Error]", error);
117 } finally {
118 this.process = undefined;
119 }
120 }
121}
122
123export function killProcess(

Callers 1

startMethod · 0.95

Calls 2

logMethod · 0.80
killMethod · 0.45

Tested by

no test coverage detected