Skip to content

Commit

Permalink
use .run method of subprocess instead of Popen
Browse files Browse the repository at this point in the history
  • Loading branch information
vtnate committed Dec 26, 2023
1 parent 13f7998 commit ed8f7d8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions geojson_modelica_translator/modelica/modelica_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def _subprocess_call_to_docker(self, run_path: Path, action: str) -> int:
'/bin/bash', '-c', f"cd mnt/shared/{model_name} && omc {mo_script}.mos"]
# execute the command that calls docker
logger.debug(f"Calling {exec_call}")
p = subprocess.Popen(
exitcode = subprocess.run(
exec_call, # type: ignore
stdout=stdout_log,
stderr=subprocess.STDOUT,
Expand All @@ -169,8 +169,7 @@ def _subprocess_call_to_docker(self, run_path: Path, action: str) -> int:
# to inspect the container and test commands.
# import time
# time.sleep(10000) # wait for the subprocess to start
logger.debug(f"Subprocess command executed, waiting for completion... \nArgs used: {p.args}")
exitcode = p.wait()
logger.debug(f"Subprocess command executed, waiting for completion... \nArgs used: {exitcode.args}")
except KeyboardInterrupt:
# List all containers and their images
docker_containers_cmd = ['docker', 'ps', '--format', '{{.ID}} {{.Image}}']
Expand Down

0 comments on commit ed8f7d8

Please sign in to comment.