Skip to content

fix: intercept upstream's self-SIGKILL fallback in e8s() - #253

Merged
bash0816 merged 1 commit into
mainfrom
fix/intercept-self-sigkill-fallback
Jul 29, 2026
Merged

fix: intercept upstream's self-SIGKILL fallback in e8s()#253
bash0816 merged 1 commit into
mainfrom
fix/intercept-self-sigkill-fallback

Conversation

@bash0816

Copy link
Copy Markdown
Owner

Summary

  • Upstream's e8s() final-exit helper falls back to a raw self-SIGKILL when process.exit() throws
  • The Termux wrapper's RequestedExit monkeypatch on process.exit causes exactly this throw, so e8s() force-kills the process, bypassing the wrapper's print-flush wait entirely
  • Intercept process.kill(process.pid, SIGKILL|9) the same way as process.exit, converting it to RequestedExit(lastExitAttemptCode) so it flows through the existing flush-wait/exit path

Test plan

  • node --test: existing 27 tests + new 6 self-sigkill-fallback fixture tests pass (33 total)
  • Device A/B: env CLAUDE_TERMUX_STDIN=inherit CLAUDE_TERMUX_PRINT_WAIT_MS=30000 claude -p ... no longer gets externally SIGKILLed

🤖 Generated with Claude Code

Upstream's final-exit helper (e8s) does `try { process.exit(e) }
catch(t) { process.kill(process.pid, "SIGKILL") }`. Because the Termux
wrapper monkeypatches process.exit to throw RequestedExit, this throw
gets caught by e8s's own catch, which force-kills the process via a
raw SIGKILL that bypasses the wrapper's RequestedExit/print-flush
handling entirely. Intercept self-directed SIGKILL the same way, so
it flows through the existing RequestedExit path instead.

Confirmed via manual instrumentation on-device: with PRINT_WAIT_MS=30000
(previously killed 9/9 runs around 7-11s), this fix produced 3/3 clean
exits with full output.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@bash0816
bash0816 merged commit 091754f into main Jul 29, 2026
4 checks passed
@bash0816
bash0816 deleted the fix/intercept-self-sigkill-fallback branch July 29, 2026 06:46
bash0816 added a commit that referenced this pull request Jul 29, 2026
Termux wrapper-only fix (process.kill self-SIGKILL interception, PR #253),
no upstream version change. Adds 2.1.220-2 offset_discovered entry (same
native binary/offsets as 2.1.220-1, which is already published to npm and
cannot be republished under the same version) and bumps
package.json/manifest to 2.1.220-2 candidate.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant