Commit 5621631f authored by Eric Duminil's avatar Eric Duminil
Browse files

Make sure chdir is set back

parent 84ff6304
......@@ -44,7 +44,7 @@ from pathlib import Path
import logging
import platform
import subprocess
import os
import contextlib
import sys
from xml.etree import ElementTree as et
......@@ -147,20 +147,20 @@ def simstadt_script():
def run_simstadt(simstadt_path: Path, workflow_path:Path , name: str):
os.chdir(simstadt_path)
try:
logging.info("\n# Launching %s:", name)
result = subprocess.run([simstadt_script(), str(workflow_path)],
text=True,
capture_output=True,
check=True
)
logging.debug(result.stderr)
logging.info(" Workflow finished succesfuly!\n")
except subprocess.CalledProcessError:
# NOTE: Current SimStadt actually never raises an error.
logging.warning(" Workflow failed!\n")
logging.info(result.stderr)
with contextlib.chdir(simstadt_path):
try:
logging.info("\n# Launching %s:", name)
result = subprocess.run([simstadt_script(), str(workflow_path)],
text=True,
capture_output=True,
check=True
)
logging.debug(result.stderr)
logging.info(" Workflow finished succesfuly!\n")
except subprocess.CalledProcessError:
# NOTE: Current SimStadt actually never raises an error.
logging.warning(" Workflow failed!\n")
logging.info(result.stderr)
def compare_written_files(repo_path: Path, before, after) -> list[Path]:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment