Improved rnx interactive mode

This commit is contained in:
Mark Qvist 2022-07-02 10:38:35 +02:00
parent 2335a71427
commit 4a725de935
1 changed files with 23 additions and 6 deletions

View File

@ -337,13 +337,15 @@ def execute(configdir, identitypath = None, verbosity = 0, quietness = 0, detail
if link == None or link.status == RNS.Link.CLOSED or link.status == RNS.Link.PENDING:
link = RNS.Link(listener_destination)
link.did_identify = False
if not spin(until=lambda: link.status == RNS.Link.ACTIVE, msg="Establishing link with "+RNS.prettyhexrep(destination_hash), timeout=timeout):
print("Could not establish link with "+RNS.prettyhexrep(destination_hash))
exit(243)
if not noid:
if not noid and not link.did_identify:
link.identify(identity)
link.did_identify = True
if stdin != None:
stdin = stdin.encode("utf-8")
@ -380,6 +382,9 @@ def execute(configdir, identitypath = None, verbosity = 0, quietness = 0, detail
if request_receipt.status == RNS.RequestReceipt.FAILED:
print("Could not request remote execution")
if interactive:
return
else:
exit(244)
spin(
@ -390,6 +395,9 @@ def execute(configdir, identitypath = None, verbosity = 0, quietness = 0, detail
if request_receipt.status == RNS.RequestReceipt.FAILED:
print("No result was received")
if interactive:
return
else:
exit(245)
spin_stat(
@ -399,6 +407,9 @@ def execute(configdir, identitypath = None, verbosity = 0, quietness = 0, detail
if request_receipt.status == RNS.RequestReceipt.FAILED:
print("Receiving result failed")
if interactive:
return
else:
exit(246)
if request_receipt.response != None:
@ -414,6 +425,9 @@ def execute(configdir, identitypath = None, verbosity = 0, quietness = 0, detail
except Exception as e:
print("Received invalid result")
if interactive:
return
else:
exit(247)
if executed:
@ -484,6 +498,9 @@ def execute(configdir, identitypath = None, verbosity = 0, quietness = 0, detail
exit(248)
else:
print("No response")
if interactive:
return
else:
exit(249)
try: