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

Function withTimeout

nodejs/src/client.ts:102–116  ·  view source on GitHub ↗
(promise: Promise<T>, timeoutMs: number, message: string)

Source from the content-addressed store, hash-verified

100}
101
102async function withTimeout<T>(promise: Promise<T>, timeoutMs: number, message: string): Promise<T> {
103 let timeout: ReturnType<typeof setTimeout> | undefined;
104 try {
105 return await Promise.race([
106 promise,
107 new Promise<never>((_, reject) => {
108 timeout = setTimeout(() => reject(new Error(message)), timeoutMs);
109 }),
110 ]);
111 } finally {
112 if (timeout !== undefined) {
113 clearTimeout(timeout);
114 }
115 }
116}
117
118async function waitForChildExit(child: ChildProcess, timeoutMs: number): Promise<boolean> {
119 if (child.exitCode != null || child.signalCode != null) {

Callers 1

stopMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…