You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(shell): add AbortSignal support via .signal() method
Add a fluent `.signal(abortSignal)` method to ShellPromise that enables
cancellation of shell commands using the standard AbortSignal API.
Features:
- AbortController.abort() sends SIGTERM to all spawned processes
- Supports AbortSignal.timeout() for automatic timeouts
- .nothrow() resolves with exit code 143 (128 + SIGTERM) instead of throwing
- Custom abort reasons are preserved in the rejection
- Already-aborted signals reject immediately without spawning processes
- Pipelines abort all processes in the pipeline
- Works with helper methods: .text(), .lines(), .json()
- Calling .signal() after shell starts throws "Shell is already running"
Implementation:
- JS layer (shell.ts): Manages AbortSignal lifecycle, tracks abort state
- Zig layer: Subprocess registry, abort signal wiring, cooperative builtin cancellation
- Builtins (yes, cat, cp, seq): Check isAborted() at yield points for cooperative cancellation
Closes#18247
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
0 commit comments