From 7f4c159c9a818beb05bc90d841e84486fcf9a020 Mon Sep 17 00:00:00 2001 From: nomadboy20 Date: Thu, 28 May 2026 05:40:29 +0200 Subject: [PATCH] Avoid shell for local file moves --- bmon/bitcoind_tasks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bmon/bitcoind_tasks.py b/bmon/bitcoind_tasks.py index d6cc75c..c2002f1 100644 --- a/bmon/bitcoind_tasks.py +++ b/bmon/bitcoind_tasks.py @@ -255,7 +255,7 @@ def mempool_activity(avro_data: dict, linehash: str): def queue_mempool_to_ship(): now_str = datetime.datetime.now().isoformat() shipfile = settings.MEMPOOL_ACTIVITY_CACHE_PATH / f"to-ship.{now_str}.avro" - subprocess.check_call(f"mv {CURRENT_MEMPOOL_FILE} {shipfile}", shell=True) + CURRENT_MEMPOOL_FILE.replace(shipfile) log.info( "moved mempool activity file %s to %s for shipment", CURRENT_MEMPOOL_FILE, @@ -288,7 +288,7 @@ def ship_mempool_activity(): d.upload_from_filename(shipfile) moved = settings.MEMPOOL_ACTIVITY_CACHE_PATH / f"shipped.{timestr}.avro" - subprocess.check_call(f"mv {shipfile} {moved}", shell=True) + shipfile.replace(moved) log.info("pushed mempool activity %s to Chaincode GCP", shipfile) except Exception: mempool_ship_lock.release() @@ -328,7 +328,7 @@ def get_latest_host() -> models.Host: def create_host_record(): def get_lshw(classn: str) -> dict: return json.loads( - subprocess.check_output(f"lshw -json -class {classn}", shell=True) + subprocess.check_output(["lshw", "-json", "-class", classn]) )[0] bitcoin_version = bitcoin.api.read_raw_bitcoind_version()