MCPcopy
hub / github.com/cloudfoundry/cli / resize

Method resize

cf/ssh/ssh.go:392–419  ·  view source on GitHub ↗
(resized <-chan os.Signal, session SecureSession, terminalFd uintptr)

Source from the content-addressed store, hash-verified

390}
391
392func (c *secureShell) resize(resized <-chan os.Signal, session SecureSession, terminalFd uintptr) {
393 type resizeMessage struct {
394 Width uint32
395 Height uint32
396 PixelWidth uint32
397 PixelHeight uint32
398 }
399
400 var previousWidth, previousHeight int
401
402 for range resized {
403 width, height := c.getWindowDimensions(terminalFd)
404
405 if width == previousWidth && height == previousHeight {
406 continue
407 }
408
409 message := resizeMessage{
410 Width: uint32(width),
411 Height: uint32(height),
412 }
413
414 _, _ = session.SendRequest("window-change", false, ssh.Marshal(message))
415
416 previousWidth = width
417 previousHeight = height
418 }
419}
420
421func keepalive(conn ssh.Conn, ticker *time.Ticker, stopCh chan struct{}) {
422 for {

Callers 1

InteractiveSessionMethod · 0.95

Calls 2

getWindowDimensionsMethod · 0.95
SendRequestMethod · 0.65

Tested by

no test coverage detected