input: return error instead of panicing, fix #2243
Doesn't make much sense panicing here.
This commit is contained in:
parent
774dee3cd4
commit
053256f43e
1 changed files with 2 additions and 2 deletions
|
@ -27,7 +27,7 @@ func ReadLine(prompt string) (string, error) {
|
||||||
if trm == nil {
|
if trm == nil {
|
||||||
s, err := term.MakeRaw(syscall.Stdin)
|
s, err := term.MakeRaw(syscall.Stdin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
return "", err
|
||||||
}
|
}
|
||||||
defer func() { _ = term.Restore(syscall.Stdin, s) }()
|
defer func() { _ = term.Restore(syscall.Stdin, s) }()
|
||||||
trm = term.NewTerminal(ReadWriter{
|
trm = term.NewTerminal(ReadWriter{
|
||||||
|
@ -52,7 +52,7 @@ func ReadPassword(prompt string) (string, error) {
|
||||||
if trm == nil {
|
if trm == nil {
|
||||||
s, err := term.MakeRaw(syscall.Stdin)
|
s, err := term.MakeRaw(syscall.Stdin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
return "", err
|
||||||
}
|
}
|
||||||
defer func() { _ = term.Restore(syscall.Stdin, s) }()
|
defer func() { _ = term.Restore(syscall.Stdin, s) }()
|
||||||
trm = term.NewTerminal(ReadWriter{os.Stdin, os.Stdout}, prompt)
|
trm = term.NewTerminal(ReadWriter{os.Stdin, os.Stdout}, prompt)
|
||||||
|
|
Loading…
Reference in a new issue