From 589c23dc233c8dfafe07292662b50baff2b95161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20K=C3=B6tter?= Date: Sun, 27 May 2018 23:44:48 +0200 Subject: [PATCH 1/3] #1795 use unix.IoctlGetWinsize to get terminal size --- internal/ui/termstatus/terminal_unix.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/ui/termstatus/terminal_unix.go b/internal/ui/termstatus/terminal_unix.go index c9f47f242..e49d62d40 100644 --- a/internal/ui/termstatus/terminal_unix.go +++ b/internal/ui/termstatus/terminal_unix.go @@ -4,8 +4,8 @@ package termstatus import ( "io" - "syscall" - "unsafe" + + "golang.org/x/sys/unix" isatty "github.com/mattn/go-isatty" ) @@ -30,10 +30,9 @@ func canUpdateStatus(fd uintptr) bool { // getTermSize returns the dimensions of the given terminal. // the code is taken from "golang.org/x/crypto/ssh/terminal" func getTermSize(fd uintptr) (width, height int, err error) { - var dimensions [4]uint16 - - if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(&dimensions)), 0, 0, 0); err != 0 { + ws, err := unix.IoctlGetWinsize(int(fd), unix.TIOCGWINSZ) + if err != nil { return -1, -1, err } - return int(dimensions[1]), int(dimensions[0]), nil + return int(ws.Col), int(ws.Row), nil } From 53040a2e3442ccae8ae7f1e094db4ca97620675f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20K=C3=B6tter?= Date: Mon, 4 Jun 2018 12:51:34 +0200 Subject: [PATCH 2/3] add "solaris/amd64" to cross-compile archs --- run_integration_tests.go | 1 + 1 file changed, 1 insertion(+) diff --git a/run_integration_tests.go b/run_integration_tests.go index 9188d0ab9..f67033436 100644 --- a/run_integration_tests.go +++ b/run_integration_tests.go @@ -135,6 +135,7 @@ func (env *TravisEnvironment) Prepare() error { "freebsd/386", "freebsd/amd64", "openbsd/386", "openbsd/amd64", "linux/arm", "freebsd/arm", + "solaris/amd64", } } else { env.goxOSArch = []string{runtime.GOOS + "/" + runtime.GOARCH} From d6fd94e49d33d4397e43d2ac836c94b0390c2f31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20K=C3=B6tter?= Date: Mon, 4 Jun 2018 15:04:50 +0200 Subject: [PATCH 3/3] Don't run Solaris build for go1.9 --- .travis.yml | 2 +- run_integration_tests.go | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3ea8ecac3..f503fa3e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ matrix: include: - os: linux go: "1.9.x" - env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0 + env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0 RESTIC_BUILD_SOLARIS=0 # only run fuse and cloud backends tests on Travis for the latest Go on Linux - os: linux diff --git a/run_integration_tests.go b/run_integration_tests.go index f67033436..0908680d2 100644 --- a/run_integration_tests.go +++ b/run_integration_tests.go @@ -135,7 +135,12 @@ func (env *TravisEnvironment) Prepare() error { "freebsd/386", "freebsd/amd64", "openbsd/386", "openbsd/amd64", "linux/arm", "freebsd/arm", - "solaris/amd64", + } + + if os.Getenv("RESTIC_BUILD_SOLARIS") == "0" { + msg("Skipping Solaris build\n") + } else { + env.goxOSArch = append(env.goxOSArch, "solaris/amd64") } } else { env.goxOSArch = []string{runtime.GOOS + "/" + runtime.GOARCH}