Fix Linux/WSL build failure in tmux terminal raw-mode handling#20
Open
Simsalaba wants to merge 1 commit intoJuliusBrussee:mainfrom
Open
Fix Linux/WSL build failure in tmux terminal raw-mode handling#20Simsalaba wants to merge 1 commit intoJuliusBrussee:mainfrom
Simsalaba wants to merge 1 commit intoJuliusBrussee:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This fixes a Linux/WSL build failure in internal/tmux/terminal.go.
The current implementation uses unix.TIOCGETA and unix.TIOCSETA, which are not available on GNU/Linux. As a result, cavekit-bin fails to build in Linux/WSL environments and cavekit team plus related subcommands remain unavailable.
This patch replaces the manual ioctl-based raw terminal handling with golang.org/x/term, which provides a cross-platform raw-mode implementation and preserves the intended behavior for callers.
Problem
On WSL/Linux, building CaveKit failed with errors like:
internal/tmux/terminal.go:11:53: undefined: unix.TIOCGETA
internal/tmux/terminal.go:27:47: undefined: unix.TIOCSETA
internal/tmux/terminal.go:37:38: undefined: unix.TIOCSETA
Change
replace manual raw terminal handling in internal/tmux/terminal.go
use golang.org/x/term.MakeRaw
use golang.org/x/term.Restore
add the required module dependency
Why this approach
Using x/term avoids platform-specific ioctl constants and is a cleaner cross-platform solution than maintaining separate low-level terminal implementations.
Tested
environment: WSL2 / Linux amd64
verified that the project builds after the change