fix(core): close turn cancellation contract gaps

This commit is contained in:
Tianyi Cui
2026-07-21 12:14:53 +08:00
parent 81cdebc531
commit c6e1d35a99
23 changed files with 185 additions and 168 deletions
+2 -2
View File
@@ -28,7 +28,7 @@ export interface RunHookOptions {
/** Working directory for the hook (defaults to the executor's own default when omitted). */
cwd?: string
/** Explicit owning-operation signal; firing it cancels the hook run. */
signal?: AbortSignal
readonly signal: AbortSignal
/** Whether to append a trailing newline to the stdin payload (CC yes, Codex no). */
trailingNewline: boolean
/**
@@ -78,9 +78,9 @@ export async function runHook(
command: hook.command,
timeoutMs,
stdin,
signal: options.signal,
...options.cwd !== undefined ? { workdir: options.cwd } : {},
...options.env !== undefined ? { env: options.env } : {},
...options.signal ? { signal: options.signal } : {},
}
try {