mirror of
https://github.com/rclone/rclone.git
synced 2024-12-23 07:29:35 +01:00
terminal, log: rename TerminalOutput to RawOut
it was confusing to have a terminal.Out along with a TerminalOutput
This commit is contained in:
parent
0687a263f8
commit
cec47699d3
@ -19,7 +19,7 @@ func redirectStderr(f *os.File) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed to duplicate stderr: %v", err)
|
log.Fatalf("Failed to duplicate stderr: %v", err)
|
||||||
}
|
}
|
||||||
terminal.TerminalOutput = os.NewFile(uintptr(passPromptFd), "passPrompt")
|
terminal.RawOut = os.NewFile(uintptr(passPromptFd), "passPrompt")
|
||||||
err = unix.Dup2(int(f.Fd()), int(os.Stderr.Fd()))
|
err = unix.Dup2(int(f.Fd()), int(os.Stderr.Fd()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed to redirect stderr to file: %v", err)
|
log.Fatalf("Failed to redirect stderr to file: %v", err)
|
||||||
|
@ -69,14 +69,14 @@ var (
|
|||||||
// make sure that start is only called once
|
// make sure that start is only called once
|
||||||
once sync.Once
|
once sync.Once
|
||||||
|
|
||||||
// TerminalOutput is for password prompt progress output
|
// RawOut is the underlying *os.File intended for terminal output
|
||||||
TerminalOutput = os.Stderr
|
RawOut = os.Stderr
|
||||||
)
|
)
|
||||||
|
|
||||||
// Start the terminal - must be called before use
|
// Start the terminal - must be called before use
|
||||||
func Start() {
|
func Start() {
|
||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
f := TerminalOutput
|
f := RawOut
|
||||||
if !IsTerminal(int(f.Fd())) {
|
if !IsTerminal(int(f.Fd())) {
|
||||||
// If output is not a tty then remove escape codes
|
// If output is not a tty then remove escape codes
|
||||||
Out = colorable.NewNonColorable(f)
|
Out = colorable.NewNonColorable(f)
|
||||||
|
Loading…
Reference in New Issue
Block a user