|
|
@@ -72,8 +72,10 @@ func GetState(fd int) (*State, error) {
|
|
|
// Restore restores the terminal connected to the given file descriptor to a
|
|
|
// previous state.
|
|
|
func Restore(fd int, state *State) error {
|
|
|
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(&state.termios)), 0, 0, 0)
|
|
|
- return err
|
|
|
+ if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(&state.termios)), 0, 0, 0); err != 0 {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ return nil
|
|
|
}
|
|
|
|
|
|
// GetSize returns the dimensions of the given terminal.
|