Skip to content

Commit b3d113c

Browse files
committed
Use stdout for windows console
Signed-off-by: Michael Crosby <[email protected]>
1 parent 4d8a41f commit b3d113c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

console.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"errors"
2121
"io"
2222
"os"
23+
"runtime"
2324
)
2425

2526
var ErrNotAConsole = errors.New("provided file is not a console")
@@ -60,7 +61,11 @@ type WinSize struct {
6061

6162
// Current returns the current processes console
6263
func Current() Console {
63-
c, err := ConsoleFromFile(os.Stdin)
64+
f := os.Stdin
65+
if runtime.GOOS == "windows" {
66+
f = os.Stdout
67+
}
68+
c, err := ConsoleFromFile(f)
6469
if err != nil {
6570
// stdin should always be a console for the design
6671
// of this function

0 commit comments

Comments
 (0)