From a361366916013e7c47ee7a70910b1295ac18d3b5 Mon Sep 17 00:00:00 2001 From: Ink33 Date: Mon, 5 Apr 2021 18:01:25 +0800 Subject: [PATCH] fix Mrs4s#794 fix unexpected ReadPassword behavior in linux --- main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.go b/main.go index 534540d..577f251 100644 --- a/main.go +++ b/main.go @@ -192,6 +192,7 @@ func main() { if len(byteKey) == 0 { log.Infof("密码加密已启用, 请输入Key对密码进行解密以继续: (Enter 提交)") cancel := make(chan struct{}, 1) + state, _ := term.GetState(int(os.Stdin.Fd())) go func() { select { case <-cancel: @@ -199,6 +200,7 @@ func main() { case <-time.After(time.Second * 45): log.Infof("解密key输入超时") time.Sleep(3 * time.Second) + _ = term.Restore(int(os.Stdin.Fd()), state) os.Exit(0) } }()