mirror of
https://github.com/basicswap/basicswap.git
synced 2026-03-19 08:17:25 +01:00
refactor: improve shutdown error messages
This commit is contained in:
@@ -1757,15 +1757,15 @@ def printHelp():
|
|||||||
|
|
||||||
|
|
||||||
def finalise_daemon(d):
|
def finalise_daemon(d):
|
||||||
logging.info("Interrupting {}".format(d.handle.pid))
|
logging.info(f"Interrupting {d.name} {d.handle.pid}")
|
||||||
try:
|
try:
|
||||||
d.handle.send_signal(signal.CTRL_C_EVENT if os.name == "nt" else signal.SIGINT)
|
d.handle.send_signal(signal.CTRL_C_EVENT if os.name == "nt" else signal.SIGINT)
|
||||||
d.handle.wait(timeout=120)
|
d.handle.wait(timeout=120)
|
||||||
except Exception as e:
|
|
||||||
logging.info(f"Error {e} for process {d.handle.pid}")
|
|
||||||
for fp in [d.handle.stdout, d.handle.stderr, d.handle.stdin] + d.files:
|
for fp in [d.handle.stdout, d.handle.stderr, d.handle.stdin] + d.files:
|
||||||
if fp:
|
if fp:
|
||||||
fp.close()
|
fp.close()
|
||||||
|
except Exception as e:
|
||||||
|
logging.info(f"Error stopping {d.name}, process {d.handle.pid}: {e}")
|
||||||
|
|
||||||
|
|
||||||
def test_particl_encryption(data_dir, settings, chain, use_tor_proxy, extra_opts):
|
def test_particl_encryption(data_dir, settings, chain, use_tor_proxy, extra_opts):
|
||||||
|
|||||||
@@ -618,7 +618,7 @@ def runClient(
|
|||||||
signal.CTRL_C_EVENT if os.name == "nt" else signal.SIGINT
|
signal.CTRL_C_EVENT if os.name == "nt" else signal.SIGINT
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
swap_client.log.info(f"Interrupting {d.name} {d.handle.pid}, error {e}")
|
swap_client.log.error(f"Interrupting {d.name} {d.handle.pid}: {e}")
|
||||||
for d in daemons:
|
for d in daemons:
|
||||||
try:
|
try:
|
||||||
d.handle.wait(timeout=120)
|
d.handle.wait(timeout=120)
|
||||||
@@ -627,7 +627,9 @@ def runClient(
|
|||||||
fp.close()
|
fp.close()
|
||||||
closed_pids.append(d.handle.pid)
|
closed_pids.append(d.handle.pid)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
swap_client.log.error(f"Error: {e}")
|
swap_client.log.error(
|
||||||
|
f"Waiting for {d.name} {d.handle.pid} to shutdown: {e}"
|
||||||
|
)
|
||||||
|
|
||||||
fail_code: int = swap_client.fail_code
|
fail_code: int = swap_client.fail_code
|
||||||
del swap_client
|
del swap_client
|
||||||
|
|||||||
Reference in New Issue
Block a user