(resized <-chan os.Signal, session SecureSession, terminalFd uintptr)
| 279 | } |
| 280 | |
| 281 | func (c *SecureShell) resize(resized <-chan os.Signal, session SecureSession, terminalFd uintptr) { |
| 282 | type resizeMessage struct { |
| 283 | Width uint32 |
| 284 | Height uint32 |
| 285 | PixelWidth uint32 |
| 286 | PixelHeight uint32 |
| 287 | } |
| 288 | |
| 289 | var previousWidth, previousHeight int |
| 290 | |
| 291 | for range resized { |
| 292 | width, height := c.getWindowDimensions(terminalFd) |
| 293 | |
| 294 | if width == previousWidth && height == previousHeight { |
| 295 | continue |
| 296 | } |
| 297 | |
| 298 | message := resizeMessage{ |
| 299 | Width: uint32(width), |
| 300 | Height: uint32(height), |
| 301 | } |
| 302 | |
| 303 | _, err := session.SendRequest("window-change", false, ssh.Marshal(message)) |
| 304 | if err != nil { |
| 305 | log.Errorln("window-change:", err) |
| 306 | } |
| 307 | |
| 308 | previousWidth = width |
| 309 | previousHeight = height |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | func (c *SecureShell) shouldAllocateTerminal(commands []string, terminalRequest TTYRequest, stdinIsTerminal bool) bool { |
| 314 | switch terminalRequest { |
no test coverage detected