mirror of
https://github.com/meshcore-dev/meshcore-cli.git
synced 2026-04-20 22:13:48 +00:00
handle login cancelation
This commit is contained in:
parent
dbcbcc1ad2
commit
452d90b352
1 changed files with 15 additions and 3 deletions
|
|
@ -976,8 +976,12 @@ async def process_contact_chat_line(mc, contact, line):
|
|||
password=f.readline().strip()
|
||||
|
||||
if password == "":
|
||||
sess = PromptSession("Password: ", is_password=True)
|
||||
password = await sess.prompt_async()
|
||||
try:
|
||||
sess = PromptSession("Password: ", is_password=True)
|
||||
password = await sess.prompt_async()
|
||||
except EOFError:
|
||||
logger.info("Canceled")
|
||||
return True
|
||||
|
||||
if password_file != "":
|
||||
with open(password_file, "w", encoding="utf-8") as f :
|
||||
|
|
@ -1990,7 +1994,12 @@ async def next_cmd(mc, cmds, json_output=False):
|
|||
else:
|
||||
print(f"Unknown contact {cmds[1]}")
|
||||
else:
|
||||
res = await mc.commands.send_login(contact, cmds[2])
|
||||
password = cmds[2]
|
||||
if password == "$":
|
||||
sess = PromptSession("Password: ", is_password=True)
|
||||
password = await sess.prompt_async()
|
||||
|
||||
res = await mc.commands.send_login(contact, password)
|
||||
logger.debug(res)
|
||||
if res.type == EventType.ERROR:
|
||||
if json_output :
|
||||
|
|
@ -2572,6 +2581,9 @@ async def next_cmd(mc, cmds, json_output=False):
|
|||
except IndexError:
|
||||
logger.error("Error in parameters, returning")
|
||||
return None
|
||||
except EOFError:
|
||||
logger.error("Cancelled")
|
||||
return None
|
||||
|
||||
async def process_cmds (mc, args, json_output=False) :
|
||||
cmds = args
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue