diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 5d1163bb4..175066102 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -290,7 +290,7 @@ class EnvironmentVariables: return value def get_env(self, full_env): - env = {} + env = full_env.copy() for method, name, values, kwargs in self.envvars: env[name] = method(full_env, name, values, kwargs) return env diff --git a/test cases/unit/2 testsetups/envcheck.py b/test cases/unit/2 testsetups/envcheck.py new file mode 100755 index 000000000..af39c4e23 --- /dev/null +++ b/test cases/unit/2 testsetups/envcheck.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python3 + +import os + +assert('PATH' in os.environ) diff --git a/test cases/unit/2 testsetups/meson.build b/test cases/unit/2 testsetups/meson.build index 58b099dde..83438569a 100644 --- a/test cases/unit/2 testsetups/meson.build +++ b/test cases/unit/2 testsetups/meson.build @@ -14,6 +14,9 @@ add_test_setup('valgrind', buggy = executable('buggy', 'buggy.c', 'impl.c') test('Test buggy', buggy) +envcheck = find_program('envcheck.py') +test('test-env', envcheck) + add_test_setup('empty') add_test_setup('onlyenv', env : env) add_test_setup('onlyenv2', env : 'TEST_ENV=1')