mirror of
https://github.com/romanz/amodem.git
synced 2026-04-20 13:16:42 +08:00
trezor: don't retry on PIN/passphrase entry cancellation
This commit is contained in:
@@ -75,6 +75,10 @@ def write(p, line):
|
|||||||
p.stdin.flush()
|
p.stdin.flush()
|
||||||
|
|
||||||
|
|
||||||
|
class UnexpectedError(Exception):
|
||||||
|
"""Unexpected response."""
|
||||||
|
|
||||||
|
|
||||||
def expect(p, prefixes):
|
def expect(p, prefixes):
|
||||||
"""Read a line and return it without required prefix."""
|
"""Read a line and return it without required prefix."""
|
||||||
resp = p.stdout.readline()
|
resp = p.stdout.readline()
|
||||||
@@ -82,7 +86,7 @@ def expect(p, prefixes):
|
|||||||
for prefix in prefixes:
|
for prefix in prefixes:
|
||||||
if resp.startswith(prefix):
|
if resp.startswith(prefix):
|
||||||
return resp[len(prefix):]
|
return resp[len(prefix):]
|
||||||
raise ValueError('Unexpected response: {}'.format(resp))
|
raise UnexpectedError(resp)
|
||||||
|
|
||||||
|
|
||||||
def interact(title, description, prompt, binary, options):
|
def interact(title, description, prompt, binary, options):
|
||||||
|
|||||||
Reference in New Issue
Block a user