Commit c7c3ef32 authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈 Committed by Kurt Hindenburg
Browse files

don't lose environment variables

the resetting was nonesense, Pty appends _environment on top of the
existing environment, so concat the two for potential sandboxing (the
ksandbox class will only apply the diff to system environment anyway).
once the sandboxing was applied reset the actual process environment to
the original variable rather than emptying it, this prevents us from
losing variables when outside a sandbox

BUG: 458591
(cherry picked from commit 252eab85)
parent ed84b89a
Pipeline #253569 passed with stage
in 8 minutes and 10 seconds
......@@ -501,12 +501,12 @@ void Session::run()
const auto originalEnvironment = _shellProcess->environment();
_shellProcess->setEnvironment(originalEnvironment + _environment);
const auto context = KSandbox::makeHostContext(*_shellProcess);
// The Pty class is incredibly janky and will topple over when starting with environment, so unset it again.
const auto result = _shellProcess->start(context.program, context.arguments, _environment);
int result = _shellProcess->start(exec, arguments, _environment);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment