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

Function withTimeout

nodejs/test/e2e/rpc_shell_user_requested.e2e.test.ts:43–61  ·  view source on GitHub ↗
(
        promise: Promise<T>,
        timeoutMs: number,
        message: string
    )

Source from the content-addressed store, hash-verified

41 }
42
43 async function withTimeout<T>(
44 promise: Promise<T>,
45 timeoutMs: number,
46 message: string
47 ): Promise<T> {
48 let timeout: ReturnType<typeof setTimeout> | undefined;
49 try {
50 return await Promise.race([
51 promise,
52 new Promise<never>((_, reject) => {
53 timeout = setTimeout(() => reject(new Error(message)), timeoutMs);
54 }),
55 ]);
56 } finally {
57 if (timeout) {
58 clearTimeout(timeout);
59 }
60 }
61 }
62
63 function tryDeleteFile(filePath: string): void {
64 try {

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…