summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-09-10 20:17:36 -0400
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-09-10 20:17:36 -0400
commit4780f71105e6494cb63a34e551cba1a4e8c75a37 (patch)
tree4049842a3749fc34734cc0f1a0d5e43986137d15
parentf3caded7d953f3f04771a2a1bf741b52f8797519 (diff)
downloadbuildstream-4780f71105e6494cb63a34e551cba1a4e8c75a37.tar.gz
element.py: Changed Element._shell() behaviors.
o The command argument is a list, not a string o The default value for the command list is ['sh', '-i'] o The sandbox is always run interactively
-rw-r--r--buildstream/element.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index c4a4da8d7..9476cf3d6 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -1347,6 +1347,7 @@ class Element(Plugin):
# Args:
# scope (Scope): Either BUILD or RUN scopes are valid, or None
# directory (str): A directory to an existing sandbox, or None
+ # command (list): An argv to launch in the sandbox
#
# Returns: Exit code
#
@@ -1366,13 +1367,14 @@ class Element(Plugin):
if os.environ.get(override) is not None:
environment[override] = os.environ.get(override)
- argv = ['sh']
- flags = SandboxFlags.NETWORK_ENABLED
+ flags = SandboxFlags.NETWORK_ENABLED | SandboxFlags.INTERACTIVE
+
if command:
- argv += ['-c', command]
+ argv = [arg for arg in command]
else:
- argv += ['-i']
- flags |= SandboxFlags.INTERACTIVE
+ argv = ['sh', '-i']
+
+ self.status("Running command", detail=" ".join(argv))
# Run shells with network enabled and readonly root.
return sandbox.run(argv, flags, env=environment)