feat(tools): require cancellation signal on every invocation
This commit is contained in:
77 files changed
+1129
-446
No files matched your search
@@ -54,8 +54,7 @@ export function apply(ctx: Context): void {
|
||||
using d = deadline(exec.signal, timeoutMs, TOOL_TIMEOUT)
|
||||
// Swap the derived deadline onto exec for dispatch, then restore the
|
||||
// caller's own signal so post-execute listeners never see this plugin's
|
||||
// (possibly already-aborted) timeout signal. `undefined` is not assignable to
|
||||
// the optional `signal` under exactOptionalPropertyTypes, so branch on it.
|
||||
// (possibly already-aborted) timeout signal.
|
||||
const upstream = exec.signal
|
||||
exec.signal = d.signal
|
||||
try {
|
||||
@@ -69,8 +68,7 @@ export function apply(ctx: Context): void {
|
||||
}
|
||||
return result
|
||||
} finally {
|
||||
if (upstream === undefined) delete exec.signal
|
||||
else exec.signal = upstream
|
||||
exec.signal = upstream
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user