From 7542571dfe2d607c74cb46ce668b64d6f78b261c Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Thu, 3 Mar 2022 12:27:47 +0100 Subject: [PATCH] Switched to Popen --- swash/processing/swash.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/swash/processing/swash.py b/swash/processing/swash.py index 7e698d3..1a739a8 100644 --- a/swash/processing/swash.py +++ b/swash/processing/swash.py @@ -46,13 +46,17 @@ with tempfile.TemporaryDirectory(prefix="swash_", dir=".") as tmp_raw: cmd = (config.get("swash", "swashrun"), "-input", inp.name, *mpi) log.info(f"Running {cmd}") - subprocess.run( + subprocess.Popen( cmd, cwd=tmpdir, stdout=logfile, stderr=logfile, ) + code = subprocess.wait() + if code is not 0: + log.error(f"Swash returned error code {code}") + log.info(f"Moving swash output to '{out}'") shutil.move(tmpdir, out)