github.com/devops-filetransfer/sshego@v7.0.4+incompatible/pty_unix.go (about)

     1  // +build darwin linux
     2  // +build !windows,!nacl,!plan9
     3  
     4  package sshego
     5  
     6  import (
     7  	"github.com/kr/pty"
     8  	"os"
     9  	"os/exec"
    10  	"syscall"
    11  	"unsafe"
    12  )
    13  
    14  func ptyStart(c *exec.Cmd) (*os.File, error) {
    15  	return pty.Start(c)
    16  }
    17  
    18  // SetWinsize sets the size of the given pty.
    19  func SetWinsize(fd uintptr, w, h uint32) {
    20  	ws := &Winsize{Width: uint16(w), Height: uint16(h)}
    21  	syscall.Syscall(syscall.SYS_IOCTL, fd, uintptr(syscall.TIOCSWINSZ), uintptr(unsafe.Pointer(ws)))
    22  }
    23  
    24  // note in the original:
    25  // Borrowed from https://github.com/creack/termios/blob/master/win/win.go