...

Source file src/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_resize-tty.go

Documentation: github.com/Microsoft/hcsshim/pkg/go-runhcs

     1  //go:build windows
     2  
     3  package runhcs
     4  
     5  import (
     6  	"context"
     7  	"strconv"
     8  )
     9  
    10  // ResizeTTYOpts is set of options that can be used with the ResizeTTY command.
    11  type ResizeTTYOpts struct {
    12  	// Pid is the process pid (defaults to init pid).
    13  	Pid *int
    14  }
    15  
    16  func (opt *ResizeTTYOpts) args() ([]string, error) {
    17  	var out []string
    18  	if opt.Pid != nil {
    19  		out = append(out, "--pid", strconv.Itoa(*opt.Pid))
    20  	}
    21  	return out, nil
    22  }
    23  
    24  // ResizeTTY updates the terminal size for a container process.
    25  func (r *Runhcs) ResizeTTY(context context.Context, id string, width, height uint16, opts *ResizeTTYOpts) error {
    26  	args := []string{"resize-tty"}
    27  	if opts != nil {
    28  		oargs, err := opts.args()
    29  		if err != nil {
    30  			return err
    31  		}
    32  		args = append(args, oargs...)
    33  	}
    34  	return r.runOrError(r.command(context, append(args, id, strconv.FormatUint(uint64(width), 10), strconv.FormatUint(uint64(height), 10))...))
    35  }
    36  

View as plain text