diff --git a/cibuildwheel/docker_container.py b/cibuildwheel/docker_container.py index c3b226aa..ecf9c52f 100644 --- a/cibuildwheel/docker_container.py +++ b/cibuildwheel/docker_container.py @@ -182,7 +182,7 @@ class DockerContainer: def environment_executor(self, command: List[str], environment: Dict[str, str]) -> str: # used as an EnvironmentExecutor to evaluate commands and capture output - return self.call(command, env=environment) + return self.call(command, env=environment, capture_output=True) def shell_quote(path: PurePath) -> str: diff --git a/unit_test/docker_container_test.py b/unit_test/docker_container_test.py index fed06174..a3b6f06d 100644 --- a/unit_test/docker_container_test.py +++ b/unit_test/docker_container_test.py @@ -8,6 +8,7 @@ from pathlib import Path, PurePath import pytest from cibuildwheel.docker_container import DockerContainer +from cibuildwheel.environment import EnvironmentAssignment # for these tests we use manylinux2014 images, because they're available on # multi architectures and include python3.8 @@ -145,3 +146,10 @@ def test_dir_operations(tmp_path: Path): container.copy_out(dst_dir, new_test_dir) assert test_binary_data == (new_test_dir / 'test.dat').read_bytes() + + +@pytest.mark.docker +def test_environment_executor(): + with DockerContainer(DEFAULT_IMAGE) as container: + assignment = EnvironmentAssignment("TEST=$(echo 42)") + assert assignment.evaluated_value({}, container.environment_executor) == "42"