How can I access one of the shell env vars when using Process
? If I use environment
to set them, it will change all of the env vars.
You might solve it appending on ProcessInfo.processInfo.environment
(the inherited environment) your custom path (or whatever you need):
let task = Process()
var environment = ProcessInfo.processInfo.environment
environment["PATH"] = "/usr/local/bin"
task.environment = environment
print(task.environment ?? "")