1
Fork 0

Switched to Popen

This commit is contained in:
Edgar P. Burkhart 2022-03-03 12:27:47 +01:00
parent 67fa3a09a5
commit 7542571dfe
Signed by: edpibu
GPG Key ID: 9833D3C5A25BD227
1 changed files with 5 additions and 1 deletions

View File

@ -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)