File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- /**
2- * Race a promise against a timeout. Returns the promise result or undefined on timeout.
3- *
4- * Note: this only stops *awaiting* the promise — it does not cancel the underlying
5- * operation (e.g. a CLI child process). Node will keep the process alive until
6- * the child exits. This is acceptable for shutdown: the OS will reap orphaned
7- * CLI processes, and a stuck child is better than blocking shutdown indefinitely.
8- */
91// ---------------------------------------------------------------------------
102// HTML helpers — shared by mentions/parse.ts and outbound/format.ts
113// ---------------------------------------------------------------------------
@@ -35,6 +27,14 @@ export function stripTags(text: string): string {
3527 return text ;
3628}
3729
30+ /**
31+ * Race a promise against a timeout. Returns the promise result or undefined on timeout.
32+ *
33+ * Note: this only stops *awaiting* the promise — it does not cancel the underlying
34+ * operation (e.g. a CLI child process). Node will keep the process alive until
35+ * the child exits. This is acceptable for shutdown: the OS will reap orphaned
36+ * CLI processes, and a stuck child is better than blocking shutdown indefinitely.
37+ */
3838export async function withTimeout < T > (
3939 promise : Promise < T > ,
4040 ms : number ,
You can’t perform that action at this time.
0 commit comments