mirror of
https://github.com/rclone/rclone.git
synced 2025-01-03 04:49:47 +01:00
lib/terminal: DEBUG which kind of terminal we are using FIXME DO NOT MERGE
This commit is contained in:
parent
f97d690535
commit
e773b07dce
@ -3,6 +3,7 @@
|
||||
package terminal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"runtime"
|
||||
@ -73,12 +74,15 @@ func Start() {
|
||||
once.Do(func() {
|
||||
f := os.Stdout
|
||||
if !terminal.IsTerminal(int(f.Fd())) {
|
||||
fmt.Fprintf(os.Stderr, "terminal: removing escape codes - no tty detected\n")
|
||||
// If stdout not a tty then remove escape codes
|
||||
Out = colorable.NewNonColorable(f)
|
||||
} else if runtime.GOOS == "windows" && os.Getenv("TERM") != "" {
|
||||
fmt.Fprintf(os.Stderr, "terminal: Windows with TERM using stdout directly\n")
|
||||
// If TERM is set just use stdout
|
||||
Out = f
|
||||
} else {
|
||||
fmt.Fprintf(os.Stderr, "terminal: using OS specific code\n")
|
||||
Out = colorable.NewColorable(f)
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user