Valentin David pushed to branch valentindavid/498_bwrap_environment at BuildStream / buildstream
Commits:
-
270cfa5c
by Valentin David at 2018-07-30T09:57:24Z
1 changed file:
Changes:
... | ... | @@ -87,6 +87,11 @@ 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.keys() - env.keys():
|
|
93 |
+ bwrap_command += ['--unsetenv', k]
|
|
94 |
+ |
|
90 | 95 |
# Create a new pid namespace, this also ensures that any subprocesses
|
91 | 96 |
# are cleaned up when the bwrap process exits.
|
92 | 97 |
bwrap_command += ['--unshare-pid']
|
... | ... | @@ -192,7 +197,7 @@ class SandboxBwrap(Sandbox): |
192 | 197 |
stdin = stack.enter_context(open(os.devnull, "r"))
|
193 | 198 |
|
194 | 199 |
# Run bubblewrap !
|
195 |
- exit_code = self.run_bwrap(bwrap_command, stdin, stdout, stderr, env,
|
|
200 |
+ exit_code = self.run_bwrap(bwrap_command, stdin, stdout, stderr, os.environ,
|
|
196 | 201 |
(flags & SandboxFlags.INTERACTIVE))
|
197 | 202 |
|
198 | 203 |
# Cleanup things which bwrap might have left behind, while
|