diff --git a/basicswap/bin/prepare.py b/basicswap/bin/prepare.py index 69ead74..3de851d 100755 --- a/basicswap/bin/prepare.py +++ b/basicswap/bin/prepare.py @@ -1757,15 +1757,15 @@ def printHelp(): def finalise_daemon(d): - logging.info("Interrupting {}".format(d.handle.pid)) + logging.info(f"Interrupting {d.name} {d.handle.pid}") try: d.handle.send_signal(signal.CTRL_C_EVENT if os.name == "nt" else signal.SIGINT) d.handle.wait(timeout=120) + for fp in [d.handle.stdout, d.handle.stderr, d.handle.stdin] + d.files: + if fp: + fp.close() 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: - if fp: - fp.close() + 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): diff --git a/basicswap/bin/run.py b/basicswap/bin/run.py index d67859f..3214f80 100755 --- a/basicswap/bin/run.py +++ b/basicswap/bin/run.py @@ -618,7 +618,7 @@ def runClient( signal.CTRL_C_EVENT if os.name == "nt" else signal.SIGINT ) 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: try: d.handle.wait(timeout=120) @@ -627,7 +627,9 @@ def runClient( fp.close() closed_pids.append(d.handle.pid) 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 del swap_client