MCPcopy Index your code
hub / github.com/coder/mux / waitForProcessExit

Function waitForProcessExit

src/node/runtime/SSHRuntime.ts:304–318  ·  view source on GitHub ↗
(proc: ChildProcess)

Source from the content-addressed store, hash-verified

302 };
303}
304async function waitForProcessExit(proc: ChildProcess): Promise<number> {
305 // Callers often consume stdout before awaiting the process. Tiny git helpers
306 // can close in that window, so make the helper safe even when subscribed late.
307 if (proc.exitCode !== null) {
308 return proc.exitCode;
309 }
310 if (proc.signalCode !== null) {
311 return 1;
312 }
313
314 return new Promise((resolve, reject) => {
315 proc.on("close", (code) => resolve(code ?? 1));
316 proc.on("error", (err) => reject(err));
317 });
318}
319
320/** Truncate SSH stderr for error logging (prefer the first transport-related line, max 200 chars). */
321function truncateSSHError(stderr: string): string {

Calls 3

rejectFunction · 0.85
onMethod · 0.80
resolveFunction · 0.50

Tested by

no test coverage detected