...
1
2
3 package runhcs
4
5 import (
6 "context"
7 "strconv"
8 )
9
10
11 type ResizeTTYOpts struct {
12
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
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