diff options
Diffstat (limited to 'libgo/go/exp/terminal/terminal.go')
-rw-r--r-- | libgo/go/exp/terminal/terminal.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libgo/go/exp/terminal/terminal.go b/libgo/go/exp/terminal/terminal.go index 05a8990b041..5732543ffc2 100644 --- a/libgo/go/exp/terminal/terminal.go +++ b/libgo/go/exp/terminal/terminal.go @@ -15,6 +15,7 @@ package terminal import ( + "io" "os" "syscall" ) @@ -34,7 +35,7 @@ func IsTerminal(fd int) bool { // MakeRaw put the terminal connected to the given file descriptor into raw // mode and returns the previous state of the terminal so that it can be // restored. -func MakeRaw(fd int) (*State, os.Error) { +func MakeRaw(fd int) (*State, error) { var oldState State if e := syscall.Tcgetattr(fd, &oldState.termios); e != 0 { return nil, os.Errno(e) @@ -52,7 +53,7 @@ func MakeRaw(fd int) (*State, os.Error) { // Restore restores the terminal connected to the given file descriptor to a // previous state. -func Restore(fd int, state *State) os.Error { +func Restore(fd int, state *State) error { e := syscall.Tcsetattr(fd, syscall.TCSANOW, &state.termios) return os.Errno(e) } @@ -60,7 +61,7 @@ func Restore(fd int, state *State) os.Error { // ReadPassword reads a line of input from a terminal without local echo. This // is commonly used for inputting passwords and other sensitive data. The slice // returned does not include the \n. -func ReadPassword(fd int) ([]byte, os.Error) { +func ReadPassword(fd int) ([]byte, error) { var oldState syscall.Termios if e := syscall.Tcgetattr(fd, &oldState); e != 0 { return nil, os.Errno(e) @@ -85,7 +86,7 @@ func ReadPassword(fd int) ([]byte, os.Error) { } if n == 0 { if len(ret) == 0 { - return nil, os.EOF + return nil, io.EOF } break } |