Clean exit for tmux provider#178
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request addresses the issue of orphaned opencode processes when using the tmux provider by implementing graceful shutdown via Ctrl-C signal instead of forcefully killing the tmux pane.
Changes:
- Modified tmux provider to send SIGINT (Ctrl-C) for clean process termination
- Improved pane_id handling by trimming whitespace at storage time rather than usage time
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| vim.fn.system("tmux send-keys -t " .. pane_id .. " C-c") | ||
| self.pane_id = nil |
There was a problem hiding this comment.
Sending C-c allows opencode to exit gracefully, but the tmux pane remains open afterward. When using toggle() to stop opencode, users will have an empty pane that needs manual cleanup. Consider either: (1) documenting this behavior, (2) adding a delayed kill-pane command, or (3) checking if the process exited before clearing pane_id to allow restart attempts to reuse the pane if the process is still running.
|
Ah good thinking, this is a very clean workaround! Thank you! I tried this with the |
Description
To have clean exit when using tmux as provider, as mentioned here
Related Issue(s)
opencodeprocess orphans when stopping #118Screenshots/Videos
n/a