-
Notifications
You must be signed in to change notification settings - Fork 133
Description
Usually in almost all circumstances /dev/sdterr is a TTY; meanwhile /dev/stdin and/or /dev/stdout can be redirected to files or pipes. (In fact if /dev/stderr is not a TTY, most likely the other two are inherited or poorly set-up, and this process isn't meant to handle the terminal.)
At the moment liner checks if any of stdin or stdout are redirected, and if so degrades to a "dumb" terminal:
Lines 38 to 49 in abb5e9d
s.terminalSupported = TerminalSupported() if m, err := TerminalMode(); err == nil { s.origMode = *m.(*termios) } else { s.inputRedirected = true } if _, err := getMode(syscall.Stdout); err != 0 { s.outputRedirected = true } if s.inputRedirected && s.outputRedirected { s.terminalSupported = false }
My proposal (which I could implement if accepted) is to either:
- (preferably) always use
/dev/stderrfor both input and output and check that itself is a TTY; - alternatively if either
stdinorstdoutseems to be redirected, check if perhapsstderris a TTY and use that;
I currently use liner in such a scenario, and for the moment I replace syscall.Stdin / syscall.Stdout with syscall.Stderr and it seems to do the trick. However this hack works in my limited case, but as said I'm willing to code this proposed feature.