diff --git a/snapcraft_legacy/plugins/v2/crystal.py b/snapcraft_legacy/plugins/v2/crystal.py index 18e11cf033..70c90520ba 100644 --- a/snapcraft_legacy/plugins/v2/crystal.py +++ b/snapcraft_legacy/plugins/v2/crystal.py @@ -96,7 +96,10 @@ def get_build_commands(self) -> List[str]: else: build_options = "" - env = dict(LANG="C.UTF-8", LC_ALL="C.UTF-8") + # Make sure snap-related environment variables survive through the shell call + # Filter environment variables for only the ones beginning with "SNAP" + snap_dict = {key: os.environ[key] for key in os.environ if key.startswith("SNAP")} + env = dict(LANG="C.UTF-8", LC_ALL="C.UTF-8", **snap_dict) env_flags = [f"{key}={value}" for key, value in env.items()] return [