Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
containerd-shim-kata-v2: add the service ResizePty support
Browse files Browse the repository at this point in the history
Add the ResizePty api support to resize the console.

Signed-off-by: ZeroMagic <[email protected]>
  • Loading branch information
ZeroMagic authored and lifupan committed Nov 28, 2018
1 parent 47326f5 commit cd321a3
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion containerd-shim-v2/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,32 @@ func (s *service) Exec(ctx context.Context, r *taskAPI.ExecProcessRequest) (*pty

// ResizePty of a process
func (s *service) ResizePty(ctx context.Context, r *taskAPI.ResizePtyRequest) (*ptypes.Empty, error) {
return nil, errdefs.ErrNotImplemented
s.Lock()
defer s.Unlock()

c, err := s.getContainer(r.ID)
if err != nil {
return nil, err
}

processID := c.id
if r.ExecID != "" {
execs, err := c.getExec(r.ExecID)
if err != nil {
return nil, err
}
execs.tty.height = r.Height
execs.tty.width = r.Width

processID = execs.id

}
err = s.sandbox.WinsizeProcess(c.id, processID, r.Height, r.Width)
if err != nil {
return nil, err
}

return empty, err
}

// State returns runtime state information for a process
Expand Down

0 comments on commit cd321a3

Please sign in to comment.