MCPcopy Create free account
hub / github.com/commandoperator/cmdop-sdk / close

Method close

node/src/transport.ts:251–282  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

249 },
250 };
251 return new AskStream(source, this.config.timeoutMs);
252 }
253
254 async close(): Promise<void> {
255 if (this.#closed) return;
256 this.#closed = true;
257 const child = this.#child;
258 if (!child) return;
259 this.#stdin?.end();
260 if (typeof child.once === "function" && typeof child.kill === "function") {
261 await new Promise<void>((resolve) => {
262 let finished = false;
263 const done = () => {
264 if (!finished) {
265 finished = true;
266 resolve();
267 }
268 };
269 child.once("exit", done);
270 setTimeout(() => {
271 if (!finished) child.kill();
272 done();
273 }, 5000);
274 });
275 }
276 this.#failAll(new ConnectionError("client closed", "transport"));
277 }
278}

Callers

nothing calls this directly

Calls 3

#failAllMethod · 0.95
endMethod · 0.80
killMethod · 0.45

Tested by

no test coverage detected