github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/pkg/bindings/containers/term_unix.go (about)

     1  //go:build !windows
     2  // +build !windows
     3  
     4  package containers
     5  
     6  import (
     7  	"context"
     8  	"os"
     9  	"os/signal"
    10  
    11  	sig "github.com/hanks177/podman/v4/pkg/signal"
    12  	"golang.org/x/term"
    13  )
    14  
    15  func makeRawTerm(stdin *os.File) (*term.State, error) {
    16  	return term.MakeRaw(int(stdin.Fd()))
    17  }
    18  
    19  func notifyWinChange(ctx context.Context, winChange chan os.Signal, stdin *os.File, stdout *os.File) {
    20  	signal.Notify(winChange, sig.SIGWINCH)
    21  }
    22  
    23  func getTermSize(stdin *os.File, stdout *os.File) (width, height int, err error) {
    24  	return term.GetSize(int(stdin.Fd()))
    25  }