diff options
Diffstat (limited to 'buildstream/sandbox/_sandboxchroot.py')
-rw-r--r-- | buildstream/sandbox/_sandboxchroot.py | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/buildstream/sandbox/_sandboxchroot.py b/buildstream/sandbox/_sandboxchroot.py index 1869468ce..64fb3c1bc 100644 --- a/buildstream/sandbox/_sandboxchroot.py +++ b/buildstream/sandbox/_sandboxchroot.py @@ -48,21 +48,11 @@ class SandboxChroot(Sandbox): def run(self, command, flags, *, cwd=None, env=None): - # Default settings - if cwd is None: - cwd = self._get_work_directory() - - if cwd is None: - cwd = '/' - - if env is None: - env = self._get_environment() - - # Naive getcwd implementations can break when bind-mounts to different - # paths on the same filesystem are present. Letting the command know - # what directory it is in makes it unnecessary to call the faulty - # getcwd. - env['PWD'] = cwd + # Fallback to the sandbox default settings for + # the cwd and env. + # + cwd = self._get_work_directory(cwd=cwd) + env = self._get_environment(cwd=cwd, env=env) if not self._has_command(command[0], env): raise SandboxError("Staged artifacts do not provide command " |