mirror of
https://github.com/octoleo/restic.git
synced 2024-11-29 16:23:59 +00:00
Merge pull request #4342 from greatroar/errors
cmd: Don't check for errno == 0
This commit is contained in:
commit
88a10a368f
@ -10,7 +10,6 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/restic/restic/internal/backend"
|
"github.com/restic/restic/internal/backend"
|
||||||
@ -151,21 +150,6 @@ func init() {
|
|||||||
restoreTerminal()
|
restoreTerminal()
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkErrno returns nil when err is set to syscall.Errno(0), since this is no
|
|
||||||
// error condition.
|
|
||||||
func checkErrno(err error) error {
|
|
||||||
e, ok := err.(syscall.Errno)
|
|
||||||
if !ok {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if e == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func stdinIsTerminal() bool {
|
func stdinIsTerminal() bool {
|
||||||
return term.IsTerminal(int(os.Stdin.Fd()))
|
return term.IsTerminal(int(os.Stdin.Fd()))
|
||||||
}
|
}
|
||||||
@ -214,7 +198,7 @@ func restoreTerminal() {
|
|||||||
if !isReadingPassword {
|
if !isReadingPassword {
|
||||||
return code, nil
|
return code, nil
|
||||||
}
|
}
|
||||||
err := checkErrno(term.Restore(fd, state))
|
err := term.Restore(fd, state)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "unable to restore terminal state: %v\n", err)
|
fmt.Fprintf(os.Stderr, "unable to restore terminal state: %v\n", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user