Skip to content

Commit

Permalink
Fix for HELICS runner spawning federates in virtual environments (#105)
Browse files Browse the repository at this point in the history
* Adding fix for issue 104

* Committing suggest use of shutil.which instead of sys.executable.

* f string embedded quote correction
  • Loading branch information
afisher1 authored Dec 26, 2024
1 parent 9e33853 commit ea0079d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion helics/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import platform
import urllib.request
import logging
import shutil
from ._version import __version__
from .status_checker import CheckStatusThread

Expand Down Expand Up @@ -305,8 +306,14 @@ def run(path, silent, connect_server, no_log_files, no_kill_on_error):
if "env" in f:
for k, v in f["env"].items():
env[k] = v
p_args = shlex.split(f["exec"])
p_args[0] = shutil.which(p_args[0])
if p_args[0] is None:
raise click.ClickException("UnrecognizedCommandError: The command specified in exec string is not a "
"recognized command in the system. The user provided exec string is "
f"{f['exec']}.")
p = subprocess.Popen(
shlex.split(f["exec"]),
p_args,
cwd=os.path.abspath(os.path.expanduser(directory)),
stdout=o.file,
stderr=o.file,
Expand Down

0 comments on commit ea0079d

Please sign in to comment.