mirror of
https://github.com/sorenisanerd/gotty.git
synced 2024-11-09 23:34:26 +00:00
Merge branch 'pr/fazalmajid/235'
This commit is contained in:
commit
3b9f472111
@ -5,7 +5,6 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
|
||||||
|
|
||||||
"github.com/kr/pty"
|
"github.com/kr/pty"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@ -99,25 +98,15 @@ func (lcmd *LocalCommand) WindowTitleVariables() map[string]interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (lcmd *LocalCommand) ResizeTerminal(width int, height int) error {
|
func (lcmd *LocalCommand) ResizeTerminal(width int, height int) error {
|
||||||
window := struct {
|
window := pty.Winsize{
|
||||||
row uint16
|
Rows: uint16(height),
|
||||||
col uint16
|
Cols: uint16(width),
|
||||||
x uint16
|
X: 0,
|
||||||
y uint16
|
Y: 0,
|
||||||
}{
|
|
||||||
uint16(height),
|
|
||||||
uint16(width),
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
}
|
}
|
||||||
_, _, errno := syscall.Syscall(
|
err := pty.Setsize(lcmd.pty, &window)
|
||||||
syscall.SYS_IOCTL,
|
if err != nil {
|
||||||
lcmd.pty.Fd(),
|
return err
|
||||||
syscall.TIOCSWINSZ,
|
|
||||||
uintptr(unsafe.Pointer(&window)),
|
|
||||||
)
|
|
||||||
if errno != 0 {
|
|
||||||
return errno
|
|
||||||
} else {
|
} else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user