Skip to content

Commit

Permalink
Add windows support (#63)
Browse files Browse the repository at this point in the history
* add windows version

* dysable syscall

* completely drop the resize events for now
  • Loading branch information
pomdtr authored Mar 5, 2025
1 parent a2c9330 commit 364d989
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
11 changes: 2 additions & 9 deletions cmd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import (
"slices"
"strings"
"sync"
"syscall"
"unsafe"

_ "embed"

Expand Down Expand Up @@ -273,7 +271,7 @@ func NewCmdUp() *cobra.Command {
cmd.Env = os.Environ()
cmd.Env = append(cmd.Env, "SMALLWEB_DISABLE_PLUGINS=true")

ptyReq, winCh, isPty := sess.Pty()
ptyReq, _, isPty := sess.Pty()
if isPty {
cmd.Env = append(cmd.Env, fmt.Sprintf("TERM=%s", ptyReq.Term))
f, err := pty.Start(cmd)
Expand All @@ -282,12 +280,7 @@ func NewCmdUp() *cobra.Command {
sess.Exit(1)
return
}
go func() {
for win := range winCh {
syscall.Syscall(syscall.SYS_IOCTL, f.Fd(), uintptr(syscall.TIOCSWINSZ),
uintptr(unsafe.Pointer(&struct{ h, w, x, y uint16 }{uint16(win.Height), uint16(win.Width), 0, 0})))
}
}()

go func() {
io.Copy(f, sess)
}()
Expand Down
1 change: 1 addition & 0 deletions goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ builds:
- -X github.com/pomdtr/smallweb/build.Date={{.Date}}
- -X github.com/pomdtr/smallweb/build.BuiltBy=goreleaser
goos:
- windows
- linux
- darwin
archives:
Expand Down

0 comments on commit 364d989

Please sign in to comment.