Replace SYS_IOCTL by cross platform version
This commit is contained in:
parent
3b96b5a830
commit
989a803a5b
12
arch.go
12
arch.go
|
@ -5,10 +5,10 @@ package gottyclient
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func notifySignalSIGWINCH(c chan<- os.Signal) {
|
func notifySignalSIGWINCH(c chan<- os.Signal) {
|
||||||
|
@ -20,12 +20,10 @@ func resetSignalSIGWINCH() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func syscallTIOCGWINSZ() ([]byte, error) {
|
func syscallTIOCGWINSZ() ([]byte, error) {
|
||||||
ws := winsize{}
|
ws, err := unix.IoctlGetWinsize(0, 0)
|
||||||
|
if err != nil {
|
||||||
syscall.Syscall(syscall.SYS_IOCTL,
|
return nil, fmt.Errorf("ioctl error: %v", err)
|
||||||
uintptr(0), uintptr(syscall.TIOCGWINSZ),
|
}
|
||||||
uintptr(unsafe.Pointer(&ws)))
|
|
||||||
|
|
||||||
b, err := json.Marshal(ws)
|
b, err := json.Marshal(ws)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("json.Marshal error: %v", err)
|
return nil, fmt.Errorf("json.Marshal error: %v", err)
|
||||||
|
|
Loading…
Reference in New Issue