mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-12 03:21:33 +00:00
terminal.IsTerminal() is not available on FreeBSD until go1.3
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"code.google.com/p/go.crypto/ssh/terminal"
|
||||
"fmt"
|
||||
"github.com/cheggaaa/pb"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -54,7 +52,7 @@ func (p *Progress) InitBar(count int64, isBytes bool) {
|
||||
if p.bar != nil {
|
||||
panic("bar already initialized")
|
||||
}
|
||||
if terminal.IsTerminal(syscall.Stdout) {
|
||||
if RunningOnTerminal() {
|
||||
p.bar = pb.New(0)
|
||||
p.bar.Total = count
|
||||
p.bar.NotPrint = true
|
||||
|
||||
12
utils/terminal.go
Normal file
12
utils/terminal.go
Normal file
@@ -0,0 +1,12 @@
|
||||
// +build !freebsd
|
||||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"code.google.com/p/go.crypto/ssh/terminal"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func RunningOnTerminal() bool {
|
||||
return terminal.IsTerminal(syscall.Stdout)
|
||||
}
|
||||
7
utils/terminal_bsd.go
Normal file
7
utils/terminal_bsd.go
Normal file
@@ -0,0 +1,7 @@
|
||||
// +build freebsd
|
||||
|
||||
package utils
|
||||
|
||||
func RunningOnTerminal() bool {
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user