MCPcopy Create free account
hub / github.com/github/copilot-sdk / waitWithTimeout

Function waitWithTimeout

nodejs/test/e2e/suspend.e2e.test.ts:32–48  ·  view source on GitHub ↗
(
    promise: Promise<T>,
    timeoutMs: number,
    label: string
)

Source from the content-addressed store, hash-verified

30}
31
32async function waitWithTimeout<T>(
33 promise: Promise<T>,
34 timeoutMs: number,
35 label: string
36): Promise<T> {
37 let timer: ReturnType<typeof setTimeout> | undefined;
38 try {
39 return await Promise.race([
40 promise,
41 new Promise<T>((_, reject) => {
42 timer = setTimeout(() => reject(new Error(`Timeout: ${label}`)), timeoutMs);
43 }),
44 ]);
45 } finally {
46 if (timer) clearTimeout(timer);
47 }
48}
49
50function onTestFinishedForceStop(client: CopilotClient): void {
51 onTestFinished(async () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…