diff --git a/test_crosscompile.sh b/test_crosscompile.sh index bbab6b2..47e8b10 100755 --- a/test_crosscompile.sh +++ b/test_crosscompile.sh @@ -4,30 +4,30 @@ # Does not actually test the logic, just the compilation so we make sure we don't break code depending on the lib. echo2() { - echo $@ >&2 + echo $@ >&2 } trap end 0 end() { - [ "$?" = 0 ] && echo2 "Pass." || (echo2 "Fail."; exit 1) + [ "$?" = 0 ] && echo2 "Pass." || (echo2 "Fail."; exit 1) } cross() { - os=$1 - shift - echo2 "Build for $os." - for arch in $@; do - echo2 " - $os/$arch" - GOOS=$os GOARCH=$arch go build - done - echo2 + os=$1 + shift + echo2 "Build for $os." + for arch in $@; do + echo2 " - $os/$arch" + GOOS=$os GOARCH=$arch go build + done + echo2 } set -e cross linux amd64 386 arm arm64 ppc64 ppc64le s390x mips mipsle mips64 mips64le cross darwin amd64 arm64 -cross freebsd amd64 386 arm arm64 ppc64 +cross freebsd amd64 386 arm arm64 cross netbsd amd64 386 arm arm64 cross openbsd amd64 386 arm arm64 cross dragonfly amd64 @@ -41,8 +41,8 @@ cross windows amd64 386 arm # Some os/arch require a different compiler. Run in docker. if ! hash docker; then - # If docker is not present, stop here. - return + # If docker is not present, stop here. + return fi echo2 "Build for linux." diff --git a/winsize.go b/winsize.go index 9660a93..57323f4 100644 --- a/winsize.go +++ b/winsize.go @@ -20,5 +20,8 @@ func InheritSize(pty, tty *os.File) error { // in each line) in terminal t. func Getsize(t *os.File) (rows, cols int, err error) { ws, err := GetsizeFull(t) - return int(ws.Rows), int(ws.Cols), err + if err != nil { + return 0, 0, err + } + return int(ws.Rows), int(ws.Cols), nil }