mirror of
https://github.com/rclone/rclone.git
synced 2025-01-03 21:09:18 +01:00
terminal: reuse PasswordPromptOutput for progress output
PasswordPromptOutput is a dup'ed copy of the stderr that the program started with - in particular, before any redirection for --log-file was applied.
This commit is contained in:
parent
7130a6d2e4
commit
458c477ad8
@ -8,6 +8,8 @@ import (
|
||||
"runtime"
|
||||
"sync"
|
||||
|
||||
"github.com/rclone/rclone/fs/config"
|
||||
|
||||
colorable "github.com/mattn/go-colorable"
|
||||
)
|
||||
|
||||
@ -73,9 +75,9 @@ var (
|
||||
// Start the terminal - must be called before use
|
||||
func Start() {
|
||||
once.Do(func() {
|
||||
f := os.Stderr
|
||||
f := config.PasswordPromptOutput
|
||||
if !IsTerminal(int(f.Fd())) {
|
||||
// If stderr not a tty then remove escape codes
|
||||
// If output is not a tty then remove escape codes
|
||||
Out = colorable.NewNonColorable(f)
|
||||
} else if runtime.GOOS == "windows" && os.Getenv("TERM") != "" {
|
||||
// If TERM is set just use stderr
|
||||
|
Loading…
Reference in New Issue
Block a user