Skip to content

Commit

Permalink
Try to test against Windows
Browse files Browse the repository at this point in the history
Adds Windows to the test matrix. We'll see what breaks.
For creack/pty, we need to use the currently-unmerged change in
`creack/pty#155` for Windows support.
  • Loading branch information
abhinav committed Sep 7, 2024
1 parent 2670f5e commit b80eebd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .changes/unreleased/Added-20240907-161636.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Added
body: Windows support.
time: 2024-09-07T16:16:36.18073-07:00
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
# Don't magically change line endings by default.
#
# Ref:
# - https://github.com/golang/go/blob/807e01db4840e25e4d98911b28a8fa54244b8dfa/.gitattributes
# - https://github.com/rogpeppe/go-internal/pull/106
* -text
*.txt text eol=lf

*.png filter=lfs diff=lfs merge=lfs -text
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
name: Test (${{ matrix.os}})
strategy:
matrix:
os: ["ubuntu-latest"] # TODO: ["windows-latest"]
os: ["ubuntu-latest", "windows-latest"]
steps:
- uses: actions/checkout@v4
- name: Set up Go
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/charmbracelet/bubbletea v1.1.0
github.com/charmbracelet/lipgloss v0.13.0
github.com/charmbracelet/log v0.4.0
github.com/creack/pty v1.1.23
github.com/creack/pty/v2 v2.0.0-20231028221118-e9c1f000f465
github.com/dustin/go-humanize v1.0.1
github.com/mattn/go-isatty v0.0.20
github.com/rogpeppe/go-internal v1.12.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ github.com/charmbracelet/x/ansi v0.2.3 h1:VfFN0NUpcjBRd4DnKfRaIRo53KRgey/nhOoEqo
github.com/charmbracelet/x/ansi v0.2.3/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw=
github.com/charmbracelet/x/term v0.2.0 h1:cNB9Ot9q8I711MyZ7myUR5HFWL/lc3OpU8jZ4hwm0x0=
github.com/charmbracelet/x/term v0.2.0/go.mod h1:GVxgxAbjUrmpvIINHIQnJJKpMlHiZ4cktEQCN6GWyF0=
github.com/creack/pty v1.1.23 h1:4M6+isWdcStXEf15G/RbrMPOQj1dZ7HPZCGwE4kOeP0=
github.com/creack/pty v1.1.23/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
github.com/creack/pty/v2 v2.0.0-20231028221118-e9c1f000f465 h1:KQ+iWxxc2qYyfK3GGrjNJ73GvDAd9Ecz8pK4FpdtI6Y=
github.com/creack/pty/v2 v2.0.0-20231028221118-e9c1f000f465/go.mod h1:zTYJ0iXAFhiKeguJdMR/LEecltLOG5Wz3lo1lIi0CLU=
github.com/danieljoos/wincred v1.2.0 h1:ozqKHaLK0W/ii4KVbbvluM91W2H3Sh0BncbUNPS7jLE=
github.com/danieljoos/wincred v1.2.0/go.mod h1:FzQLLMKBFdvu+osBrnFODiv32YGwCfx0SkRa/eYHgec=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down
7 changes: 3 additions & 4 deletions internal/termtest/with_term.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"sync"
"time"

"github.com/creack/pty"
"github.com/creack/pty/v2"
"github.com/vito/midterm"
)

Expand Down Expand Up @@ -254,14 +254,14 @@ func WithTerm() (exitCode int) {
type terminalEmulator struct {
mu sync.Mutex
cmd *exec.Cmd
pty *os.File
pty pty.Pty
logf func(string, ...any)

term *midterm.Terminal
}

func newVT100Emulator(
f *os.File,
f pty.Pty,
cmd *exec.Cmd,
rows, cols int,
autoResize bool,
Expand Down Expand Up @@ -329,7 +329,6 @@ func (m *terminalEmulator) Close() error {

func (m *terminalEmulator) FeedKeys(s string) error {
_, err := io.WriteString(m.pty, s)
_ = m.pty.Sync()
return err
}

Expand Down

0 comments on commit b80eebd

Please sign in to comment.