Skip to content

Commit 7a61819

Browse files
committed
Update read write on windows console
Signed-off-by: Michael Crosby <[email protected]>
1 parent 8894ab3 commit 7a61819

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

console.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"errors"
2121
"io"
2222
"os"
23-
"runtime"
2423
)
2524

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

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

console_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ func (m *master) Close() error {
150150
}
151151

152152
func (m *master) Read(b []byte) (int, error) {
153-
panic("not implemented on windows")
153+
return os.Stdin.Read(b)
154154
}
155155

156156
func (m *master) Write(b []byte) (int, error) {
157-
panic("not implemented on windows")
157+
return os.Stdout.Write(b)
158158
}
159159

160160
func (m *master) Fd() uintptr {

0 commit comments

Comments
 (0)