From bbeefc343233f7b1d06ef767c9e58514aa5b7d9e Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Fri, 31 May 2024 06:18:54 +0000 Subject: [PATCH] made sure bash can be anywere for subprocess in configure getting configs --- src/wxflow/configuration.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wxflow/configuration.py b/src/wxflow/configuration.py index 2a4395e..633f6fe 100644 --- a/src/wxflow/configuration.py +++ b/src/wxflow/configuration.py @@ -3,6 +3,7 @@ import random from typing import Optional import subprocess +import shutil from pathlib import Path from pprint import pprint from typing import Any, Dict, List, Union @@ -111,8 +112,9 @@ def _get_shell_env(scripts: List) -> Dict[str, Any]: runme = ''.join([f'source {s} ; ' for s in scripts]) magic = f'--- ENVIRONMENT BEGIN {random.randint(0,64**5)} ---' runme += f'/bin/echo -n "{magic}" ; /usr/bin/env -0' + bash_path = shutil.which('bash') with open('/dev/null', 'w') as null: - env = subprocess.Popen(runme, shell=True, executable='/bin/bash', stdin=null.fileno(), + env = subprocess.Popen(runme, shell=True, executable=bash_path, stdin=null.fileno(), stdout=subprocess.PIPE) (out, err) = env.communicate() out = out.decode()