diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-02-23 19:36:30 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-02-24 23:08:50 +0900 |
commit | 4ff02b9c4a6080451564293c0c58967a15513174 (patch) | |
tree | 1ed6c35fa71b04452db20a69161f4994f0268606 | |
parent | 1476e43633b0798a013c46e740271bdd0ce9187d (diff) | |
download | buildstream-4ff02b9c4a6080451564293c0c58967a15513174.tar.gz |
element.py: Element._shell() now allows a custom prompt for PS1
-rw-r--r-- | buildstream/element.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/buildstream/element.py b/buildstream/element.py index f0df03b26..b4739c3bb 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -1369,17 +1369,22 @@ class Element(Plugin): # scope (Scope): Either BUILD or RUN scopes are valid, or None # directory (str): A directory to an existing sandbox, or None # isolate (bool): Whether to isolate the environment like we do in builds + # prompt (str): A suitable prompt string for PS1 # command (list): An argv to launch in the sandbox # # Returns: Exit code # # If directory is not specified, one will be staged using scope - def _shell(self, scope=None, directory=None, isolate=False, command=None): + def _shell(self, scope=None, directory=None, isolate=False, prompt=None, command=None): with self._prepare_sandbox(scope, directory) as sandbox: environment = self.get_environment() + environment = copy.copy(environment) flags = SandboxFlags.INTERACTIVE | SandboxFlags.ROOT_READ_ONLY + if prompt is not None: + environment['PS1'] = prompt + # Special configurations for non-isolated sandboxes if not isolate: @@ -1391,7 +1396,6 @@ class Element(Plugin): # with some of the host environment and use that for the shell. # # XXX Hard code should be removed - environment = copy.copy(environment) overrides = ['DISPLAY', 'DBUS_SESSION_BUS_ADDRESS'] for override in overrides: if os.environ.get(override) is not None: |