MCPcopy Index your code
hub / github.com/github/copilot-sdk / waitForChildExit

Function waitForChildExit

nodejs/src/client.ts:118–147  ·  view source on GitHub ↗
(child: ChildProcess, timeoutMs: number)

Source from the content-addressed store, hash-verified

116}
117
118async function waitForChildExit(child: ChildProcess, timeoutMs: number): Promise<boolean> {
119 if (child.exitCode != null || child.signalCode != null) {
120 return true;
121 }
122
123 return new Promise<boolean>((resolve) => {
124 let timeout: ReturnType<typeof setTimeout>;
125 let settled = false;
126 const onExit = () => {
127 if (settled) {
128 return;
129 }
130 settled = true;
131 clearTimeout(timeout);
132 resolve(true);
133 };
134 timeout = setTimeout(() => {
135 if (settled) {
136 return;
137 }
138 settled = true;
139 child.off("exit", onExit);
140 resolve(false);
141 }, timeoutMs);
142 child.once("exit", onExit);
143 if (child.exitCode != null || child.signalCode != null) {
144 onExit();
145 }
146 });
147}
148
149/**
150 * Convert tool parameters to JSON schema format for sending to CLI

Callers 1

stopMethod · 0.85

Calls 1

onExitFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…