resizeTTYTo resizes TTY to specific height and width.
(ctx context.Context, apiClient resizeClient, id string, height, width uint, isExec bool)
| 25 | |
| 26 | // resizeTTYTo resizes TTY to specific height and width. |
| 27 | func resizeTTYTo(ctx context.Context, apiClient resizeClient, id string, height, width uint, isExec bool) error { |
| 28 | if height == 0 && width == 0 { |
| 29 | return nil |
| 30 | } |
| 31 | |
| 32 | var err error |
| 33 | if isExec { |
| 34 | _, err = apiClient.ExecResize(ctx, id, client.ExecResizeOptions{ |
| 35 | Height: height, |
| 36 | Width: width, |
| 37 | }) |
| 38 | } else { |
| 39 | _, err = apiClient.ContainerResize(ctx, id, client.ContainerResizeOptions{ |
| 40 | Height: height, |
| 41 | Width: width, |
| 42 | }) |
| 43 | } |
| 44 | |
| 45 | if err != nil { |
| 46 | logrus.Debugf("Error resize: %s\r", err) |
| 47 | } |
| 48 | return err |
| 49 | } |
| 50 | |
| 51 | // resizeTty is to resize the tty with cli out's tty size |
| 52 | func resizeTty(ctx context.Context, cli command.Cli, id string, isExec bool) error { |
searching dependent graphs…