Workaround fix password issues on Windows.
This commit is contained in:
parent
678a7efaaa
commit
5fc07fef75
|
@ -187,8 +187,16 @@ proc saveWallet*(wallet: Wallet, outWalletPath: string): Result[void, string] =
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
proc readPasswordInput(prompt: string, password: var TaintedString): bool =
|
proc readPasswordInput(prompt: string, password: var TaintedString): bool =
|
||||||
try: readPasswordFromStdin(prompt, password)
|
try:
|
||||||
except IOError: false
|
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]) =
|
proc setStyleNoError(styles: set[Style]) =
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
|
@ -340,9 +348,9 @@ proc createWalletInteractively*(
|
||||||
|
|
||||||
template prompt: string =
|
template prompt: string =
|
||||||
if firstTry:
|
if firstTry:
|
||||||
"Please enter a password:"
|
"Please enter a password: "
|
||||||
else:
|
else:
|
||||||
"Please enter a new password:"
|
"Please enter a new password: "
|
||||||
|
|
||||||
while true:
|
while true:
|
||||||
if not readPasswordInput(prompt, password):
|
if not readPasswordInput(prompt, password):
|
||||||
|
|
Loading…
Reference in New Issue