Commit Graph

2 Commits

Author SHA1 Message Date
autofix-ci[bot]
a4afa11642 [autofix.ci] apply automated fixes 2025-08-25 08:49:16 +00:00
Claude Bot
ecb11528d4 Add .kill() method to ShellPromise for terminating processes
This adds a new .kill(signal?) method to ShellPromise that allows users to terminate long-running shell processes.

Features:
- Kill processes with default SIGTERM (15)
- Accept numeric signal codes: .kill(9) for SIGKILL
- Accept named signals: .kill("SIGTERM") or .kill("TERM")
- Returns boolean indicating if any processes were killed
- Safe to call on processes that haven't started (returns false)
- Safe to call on processes that already exited (returns false)
- Properly handles pipelines by tracking all active subprocesses

Implementation:
- Added subprocess tracking to Interpreter via active_subprocesses list
- Added registerSubprocess/unregisterSubprocess methods
- Modified Cmd state to register/unregister subprocesses on spawn/cleanup
- Added JavaScript kill method with signal parsing and validation
- Added C++ binding for kill method in ShellInterpreter
- Added comprehensive test suite covering all use cases

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-25 08:47:30 +00:00