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