Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
buildstream
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
6
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
BuildStream
buildstream
Commits
5dcecbad
Commit
5dcecbad
authored
6 years ago
by
Valentin David
Committed by
Valentin David
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Set environment in bwrap command line instead of its environment
Fixes
#498
parent
04cee9a9
No related branches found
No related tags found
1 merge request
!565
Set environment in bwrap command line instead of its environment
Pipeline
#27644649
passed
6 years ago
Stage: prepare
Stage: test
Stage: post
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
buildstream/sandbox/_sandboxbwrap.py
+7
-3
7 additions, 3 deletions
buildstream/sandbox/_sandboxbwrap.py
with
7 additions
and
3 deletions
buildstream/sandbox/_sandboxbwrap.py
+
7
−
3
View file @
5dcecbad
...
...
@@ -89,6 +89,11 @@ class SandboxBwrap(Sandbox):
# Grab the full path of the bwrap binary
bwrap_command
=
[
utils
.
get_host_tool
(
'
bwrap
'
)]
for
k
,
v
in
env
.
items
():
bwrap_command
+=
[
'
--setenv
'
,
k
,
v
]
for
k
in
os
.
environ
.
keys
()
-
env
.
keys
():
bwrap_command
+=
[
'
--unsetenv
'
,
k
]
# Create a new pid namespace, this also ensures that any subprocesses
# are cleaned up when the bwrap process exits.
bwrap_command
+=
[
'
--unshare-pid
'
]
...
...
@@ -194,7 +199,7 @@ class SandboxBwrap(Sandbox):
stdin
=
stack
.
enter_context
(
open
(
os
.
devnull
,
"
r
"
))
# Run bubblewrap !
exit_code
=
self
.
run_bwrap
(
bwrap_command
,
stdin
,
stdout
,
stderr
,
env
,
exit_code
=
self
.
run_bwrap
(
bwrap_command
,
stdin
,
stdout
,
stderr
,
(
flags
&
SandboxFlags
.
INTERACTIVE
))
# Cleanup things which bwrap might have left behind, while
...
...
@@ -245,7 +250,7 @@ class SandboxBwrap(Sandbox):
return
exit_code
def
run_bwrap
(
self
,
argv
,
stdin
,
stdout
,
stderr
,
env
,
interactive
):
def
run_bwrap
(
self
,
argv
,
stdin
,
stdout
,
stderr
,
interactive
):
# Wrapper around subprocess.Popen() with common settings.
#
# This function blocks until the subprocess has terminated.
...
...
@@ -321,7 +326,6 @@ class SandboxBwrap(Sandbox):
# The default is to share file descriptors from the parent process
# to the subprocess, which is rarely good for sandboxing.
close_fds
=
True
,
env
=
env
,
stdin
=
stdin
,
stdout
=
stdout
,
stderr
=
stderr
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment