Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #17

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
uses: golangci/[email protected]

testmac:
runs-on: macos-latest # beta arm runner
runs-on: macos-14 # beta arm runner
strategy:
matrix:
goos:
Expand Down
32 changes: 25 additions & 7 deletions internal/adapters/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/docker/docker/client"
resty "github.com/go-resty/resty/v2"
"github.com/moby/term"
"github.com/sirupsen/logrus"
"io"
"net"
"os"
Expand Down Expand Up @@ -140,8 +141,13 @@ func (d *DockerAdapter) RunCloudControl(_ string, name string, consoleWidth uint
case <-quitWriter:
return
default:
if b, err := s.ReadByte(); err == nil {
_, _ = stdout.Write([]byte{b})
if b, err := s.ReadByte(); err != nil {
logrus.Errorf("error reading from Docker: %s", err)
return
} else {
if _, err := stdout.Write([]byte{b}); err != nil {
logrus.Errorf("error writing to stdout: %s", err)
}
}
}
}
Expand All @@ -154,8 +160,14 @@ func (d *DockerAdapter) RunCloudControl(_ string, name string, consoleWidth uint
case <-quitReader:
return
default:
if b, err := s.ReadByte(); err == nil {
_, _ = c.Write([]byte{b})
if b, err := s.ReadByte(); err != nil {
logrus.Errorf("error reading from Docker: %s", err)
return
} else {
if _, err := c.Write([]byte{b}); err != nil {
logrus.Errorf("error writing to Docker: %s", err)
return
}
}
}
}
Expand All @@ -169,14 +181,20 @@ func (d *DockerAdapter) RunCloudControl(_ string, name string, consoleWidth uint
case <-quitTermResize:
return
default:
if w, err := term.GetWinsize(fd); err == nil {
if w, err := term.GetWinsize(fd); err != nil {
logrus.Errorf("error getting terminal size: %s", err)
return
} else {
if w.Width != uint16(width) || w.Height != uint16(height) {
width = uint(w.Width)
height = uint(w.Height)
_ = dockerCli.ContainerExecResize(context.Background(), executeID, types.ResizeOptions{
if err := dockerCli.ContainerExecResize(context.Background(), executeID, types.ResizeOptions{
Width: width,
Height: height,
})
}); err != nil {
logrus.Errorf("error resizing container terminal: %s", err)
return
}
}
}
}
Expand Down
Loading