Valentin David pushed to branch valentindavid/498_bwrap_environment at BuildStream / buildstream
Commits:
-
2fe85301
by Valentin David at 2018-07-30T09:36:56Z
1 changed file:
Changes:
... | ... | @@ -87,6 +87,12 @@ class SandboxBwrap(Sandbox): |
87 | 87 |
# Grab the full path of the bwrap binary
|
88 | 88 |
bwrap_command = [utils.get_host_tool('bwrap')]
|
89 | 89 |
|
90 |
+ for k, v in env.items():
|
|
91 |
+ bwrap_command += ['--setenv', k, v]
|
|
92 |
+ for k, _ in os.environ.items():
|
|
93 |
+ if k not in env:
|
|
94 |
+ bwrap_command += ['--unsetenv', k]
|
|
95 |
+ |
|
90 | 96 |
# Create a new pid namespace, this also ensures that any subprocesses
|
91 | 97 |
# are cleaned up when the bwrap process exits.
|
92 | 98 |
bwrap_command += ['--unshare-pid']
|
... | ... | @@ -192,7 +198,7 @@ class SandboxBwrap(Sandbox): |
192 | 198 |
stdin = stack.enter_context(open(os.devnull, "r"))
|
193 | 199 |
|
194 | 200 |
# Run bubblewrap !
|
195 |
- exit_code = self.run_bwrap(bwrap_command, stdin, stdout, stderr, env,
|
|
201 |
+ exit_code = self.run_bwrap(bwrap_command, stdin, stdout, stderr, os.environ,
|
|
196 | 202 |
(flags & SandboxFlags.INTERACTIVE))
|
197 | 203 |
|
198 | 204 |
# Cleanup things which bwrap might have left behind, while
|