summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/terminal/terminal.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-07-06 14:26:11 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-07-06 16:57:07 +0200
commitcc6faddfaaa7dad7e07e3113e14328d625636ace (patch)
tree9fff638b7cbad8a65d7321be32fcc480a5a7bdc4 /pkg/domain/infra/abi/terminal/terminal.go
parent49df3cc5cb7e6a1d9e28cacfa86562abbdf48fd9 (diff)
downloadpodman-cc6faddfaaa7dad7e07e3113e14328d625636ace.tar.gz
podman-cc6faddfaaa7dad7e07e3113e14328d625636ace.tar.bz2
podman-cc6faddfaaa7dad7e07e3113e14328d625636ace.zip
use c/common code for resize and CopyDetachable
Since conmon-rs also uses this code we moved it to c/common. Now podman should has this also to prevent duplication. [NO NEW TESTS NEEDED] Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'pkg/domain/infra/abi/terminal/terminal.go')
-rw-r--r--pkg/domain/infra/abi/terminal/terminal.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkg/domain/infra/abi/terminal/terminal.go b/pkg/domain/infra/abi/terminal/terminal.go
index 692f8dcd5..45ebded26 100644
--- a/pkg/domain/infra/abi/terminal/terminal.go
+++ b/pkg/domain/infra/abi/terminal/terminal.go
@@ -5,7 +5,7 @@ import (
"os"
"os/signal"
- "github.com/containers/podman/v4/libpod/define"
+ "github.com/containers/common/pkg/resize"
lsignal "github.com/containers/podman/v4/pkg/signal"
"github.com/moby/term"
"github.com/pkg/errors"
@@ -18,20 +18,20 @@ type RawTtyFormatter struct {
// getResize returns a TerminalSize command matching stdin's current
// size on success, and nil on errors.
-func getResize() *define.TerminalSize {
+func getResize() *resize.TerminalSize {
winsize, err := term.GetWinsize(os.Stdin.Fd())
if err != nil {
logrus.Warnf("Could not get terminal size %v", err)
return nil
}
- return &define.TerminalSize{
+ return &resize.TerminalSize{
Width: winsize.Width,
Height: winsize.Height,
}
}
// Helper for prepareAttach - set up a goroutine to generate terminal resize events
-func resizeTty(ctx context.Context, resize chan define.TerminalSize) {
+func resizeTty(ctx context.Context, resize chan resize.TerminalSize) {
sigchan := make(chan os.Signal, 1)
signal.Notify(sigchan, lsignal.SIGWINCH)
go func() {
@@ -78,7 +78,7 @@ func (f *RawTtyFormatter) Format(entry *logrus.Entry) ([]byte, error) {
return bytes, err
}
-func handleTerminalAttach(ctx context.Context, resize chan define.TerminalSize) (context.CancelFunc, *term.State, error) {
+func handleTerminalAttach(ctx context.Context, resize chan resize.TerminalSize) (context.CancelFunc, *term.State, error) {
logrus.Debugf("Handling terminal attach")
subCtx, cancel := context.WithCancel(ctx)