You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're already using the Command interface on all platforms since we need to spawn a separate process on Linux. However we're still manually removing the environment variables from the process which seems fragile.
This removes all inherited environment variables, after which they can be added again with Command::env and Command::envs. The inherited variables stay cleared.
This also works on Linux with the new PID 1 init, even if PID 1 itself still has these variables set, since PID 2 cannot read /proc/1/environ based on my testing.
The text was updated successfully, but these errors were encountered:
We're already using the
Command
interface on all platforms since we need to spawn a separate process on Linux. However we're still manually removing the environment variables from the process which seems fragile.Instead, we should use the
Command::env_clear
method instead:https://doc.rust-lang.org/std/process/struct.Command.html#method.env_clear
This removes all inherited environment variables, after which they can be added again with
Command::env
andCommand::envs
. The inherited variables stay cleared.This also works on Linux with the new PID 1 init, even if PID 1 itself still has these variables set, since PID 2 cannot read
/proc/1/environ
based on my testing.The text was updated successfully, but these errors were encountered: