From 5fc07fef756de2ecc8574f6415e55f22046b2d8f Mon Sep 17 00:00:00 2001 From: cheatfate Date: Fri, 21 Aug 2020 12:47:35 +0300 Subject: [PATCH] Workaround fix password issues on Windows. --- beacon_chain/keystore_management.nim | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/beacon_chain/keystore_management.nim b/beacon_chain/keystore_management.nim index f5735e2e9..a4fbc7b42 100644 --- a/beacon_chain/keystore_management.nim +++ b/beacon_chain/keystore_management.nim @@ -187,8 +187,16 @@ proc saveWallet*(wallet: Wallet, outWalletPath: string): Result[void, string] = ok() proc readPasswordInput(prompt: string, password: var TaintedString): bool = - try: readPasswordFromStdin(prompt, password) - except IOError: false + try: + when defined(windows): + # readPasswordFromStdin() on Windows always returns `false`. + # https://github.com/nim-lang/Nim/issues/15207 + discard readPasswordFromStdin(prompt, password) + true + else: + readPasswordFromStdin(prompt, password) + except IOError as exc: + false proc setStyleNoError(styles: set[Style]) = when defined(windows): @@ -340,9 +348,9 @@ proc createWalletInteractively*( template prompt: string = if firstTry: - "Please enter a password:" + "Please enter a password: " else: - "Please enter a new password:" + "Please enter a new password: " while true: if not readPasswordInput(prompt, password):