Skip to content

fix(core): handle SIGHUP and kill process#16057

Merged
thdxr merged 1 commit intodevfrom
jlongster/sighup
Mar 4, 2026
Merged

fix(core): handle SIGHUP and kill process#16057
thdxr merged 1 commit intodevfrom
jlongster/sighup

Conversation

@jlongster
Copy link
Contributor

opencode doesn't always cleanly exist: one example is when it's running and you just close a tab. In this case opencode hangs around forever (see thread). This should fix it.

I didn't record a video, but I reproduced the hanging process. After applying this PR, the process is killed after closing the tab (it takes a few seconds)

@Hona
Copy link
Member

Hona commented Mar 4, 2026

🐐

@thdxr thdxr enabled auto-merge (squash) March 4, 2026 23:04
@thdxr thdxr merged commit 45ac20b into dev Mar 4, 2026
12 checks passed
@thdxr thdxr deleted the jlongster/sighup branch March 4, 2026 23:12
jlongster added a commit that referenced this pull request Mar 9, 2026
manno23 pushed a commit to manno23/opencode that referenced this pull request Mar 12, 2026
demostanis pushed a commit to demostanis/opencode that referenced this pull request Mar 19, 2026
thdxr added a commit that referenced this pull request Mar 21, 2026
This restores the SIGHUP handler that was previously reverted. The handler ensures the process exits on terminal hangup (eg. closing the terminal tab), preventing long-running commands like `serve` from becoming orphaned processes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants