Remove some OS from .goxc.json file
This commit is contained in:
parent
cbfcf7b358
commit
2effb888f5
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"AppName": "gotty-client",
|
"AppName": "gotty-client",
|
||||||
"ArtifactsDest": "dist",
|
"ArtifactsDest": "dist",
|
||||||
|
"BuildConstraints": "!plan9,!nacl,!solaris",
|
||||||
"OutPath": "{{.Dest}}{{.PS}}{{.Version}}{{.PS}}{{.ExeName}}_{{.Version}}_{{.Os}}_{{.Arch}}{{.Ext}}",
|
"OutPath": "{{.Dest}}{{.PS}}{{.Version}}{{.PS}}{{.ExeName}}_{{.Version}}_{{.Os}}_{{.Arch}}{{.Ext}}",
|
||||||
"TasksExclude": [
|
"TasksExclude": [
|
||||||
"go-test",
|
"go-test",
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
|
package gottyclient
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
func notifySignalSIGWINCH(c chan<- os.Signal) {
|
||||||
|
signal.Notify(c, syscall.SIGWINCH)
|
||||||
|
}
|
||||||
|
|
||||||
|
func resetSignalSIGWINCH() {
|
||||||
|
signal.Reset(syscall.SIGWINCH)
|
||||||
|
}
|
||||||
|
|
||||||
|
func syscallTIOCGWINSZ() ([]byte, error) {
|
||||||
|
ws := winsize{}
|
||||||
|
|
||||||
|
syscall.Syscall(syscall.SYS_IOCTL,
|
||||||
|
uintptr(0), uintptr(syscall.TIOCGWINSZ),
|
||||||
|
uintptr(unsafe.Pointer(&ws)))
|
||||||
|
|
||||||
|
b, err := json.Marshal(ws)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("json.Marshal error: %v", err)
|
||||||
|
}
|
||||||
|
return b, err
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package gottyclient
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func notifySignalSIGWINCH(c chan<- os.Signal) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func resetSignalSIGWINCH() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func syscallTIOCGWINSZ() ([]byte, error) {
|
||||||
|
return nil, errors.New("SIGWINCH isn't supported on this ARCH")
|
||||||
|
}
|
|
@ -9,13 +9,10 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
|
||||||
|
|
||||||
"github.com/moul/gotty-client/vendor/github.com/Sirupsen/logrus"
|
"github.com/moul/gotty-client/vendor/github.com/Sirupsen/logrus"
|
||||||
"github.com/moul/gotty-client/vendor/github.com/creack/goselect"
|
"github.com/moul/gotty-client/vendor/github.com/creack/goselect"
|
||||||
|
@ -243,23 +240,16 @@ type winsize struct {
|
||||||
func (c *Client) termsizeLoop(wg *sync.WaitGroup) {
|
func (c *Client) termsizeLoop(wg *sync.WaitGroup) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
ch := make(chan os.Signal, 1)
|
ch := make(chan os.Signal, 1)
|
||||||
signal.Notify(ch, syscall.SIGWINCH)
|
notifySignalSIGWINCH(ch)
|
||||||
defer signal.Reset(syscall.SIGWINCH)
|
defer resetSignalSIGWINCH()
|
||||||
ws := winsize{}
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
syscall.Syscall(syscall.SYS_IOCTL,
|
if b, err := syscallTIOCGWINSZ(); err != nil {
|
||||||
uintptr(0), uintptr(syscall.TIOCGWINSZ),
|
logrus.Warn(err)
|
||||||
uintptr(unsafe.Pointer(&ws)))
|
} else {
|
||||||
|
if err = c.write(append([]byte("2"), b...)); err != nil {
|
||||||
b, err := json.Marshal(ws)
|
logrus.Warnf("ws.WriteMessage failed: %v", err)
|
||||||
if err != nil {
|
}
|
||||||
logrus.Warnf("json.Marshal error: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = c.write(append([]byte("2"), b...))
|
|
||||||
if err != nil {
|
|
||||||
logrus.Warnf("ws.WriteMessage failed: %v", err)
|
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
case <-c.QuitChan:
|
case <-c.QuitChan:
|
||||||
|
|
Loading…
Reference in New Issue