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