at 24.11-pre 1.7 kB view raw
1diff --git a/craft_parts/executor/step_handler.py b/craft_parts/executor/step_handler.py 2index 404df69..f90e2ac 100644 3--- a/craft_parts/executor/step_handler.py 4+++ b/craft_parts/executor/step_handler.py 5@@ -243,8 +243,9 @@ class StepHandler: 6 print(script, file=script_file) 7 script_file.flush() 8 script_file.seek(0) 9+ import shutil 10 process = subprocess.Popen( # pylint: disable=consider-using-with 11- ["/bin/bash"], 12+ [shutil.which("bash")], 13 stdin=script_file, 14 cwd=work_dir, 15 stdout=self._stdout, 16@@ -394,7 +395,8 @@ def _create_and_run_script( 17 ) -> None: 18 """Create a script with step-specific commands and execute it.""" 19 with script_path.open("w") as run_file: 20- print("#!/bin/bash", file=run_file) 21+ import shutil 22+ print(f"#!{shutil.which('bash')}", file=run_file) 23 print("set -euo pipefail", file=run_file) 24 25 if build_environment_script_path: 26diff --git a/craft_parts/plugins/validator.py b/craft_parts/plugins/validator.py 27index b8d8f11..fce0e72 100644 28--- a/craft_parts/plugins/validator.py 29+++ b/craft_parts/plugins/validator.py 30@@ -142,9 +142,9 @@ class PluginEnvironmentValidator: 31 print(self._env, file=env_file) 32 print(cmd, file=env_file) 33 env_file.flush() 34- 35+ import shutil 36 proc = subprocess.run( 37- ["/bin/bash", env_file.name], 38+ [shutil.which("bash"), env_file.name], 39 check=True, 40 capture_output=True, 41 text=True,