MCPcopy Create free account
hub / github.com/braintrustdata/bash-agent-evals / withTimeout

Function withTimeout

src/agents/bash-sqlite-agent.ts:141–157  ·  view source on GitHub ↗
(promise: Promise<T>, timeoutMs: number, command: string)

Source from the content-addressed store, hash-verified

139}
140
141function withTimeout<T>(promise: Promise<T>, timeoutMs: number, command: string): Promise<T> {
142 return new Promise((resolve, reject) => {
143 const timer = setTimeout(() => {
144 reject(new TimeoutError(command, timeoutMs));
145 }, timeoutMs);
146
147 promise
148 .then((result) => {
149 clearTimeout(timer);
150 resolve(result);
151 })
152 .catch((err) => {
153 clearTimeout(timer);
154 reject(err);
155 });
156 });
157}
158
159function createTimeoutBash(bash: Bash, timeoutMs: number) {
160 return {

Callers 1

execFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected