[SR-6511] Running swift run Foo
has extra environment variables over .build/debug/Foo
which can interfere with the spawned executable
#4905
Labels
Attachment: Download
Additional Detail from JIRA
md5: 8c5cca3f28f5e8b709e2517147615412
Issue Description:
Filing on behalf of czechboy0 (JIRA User)
I discovered today that running a tool with `swift run Foo` has extra environment variables: CPATH, LIBRARY_PATH and SDKROOT.
These can interfere with the spawned tool. It did for me, as my tool itself called xcodebuild later, and these variables made the sample project not to compile.
A workaround is to instead `swift build` and `.build/debug/Foo` manually, which works fine.
I attached a sample project that contains a script that dumps the two environments and diffs them, where you can clearly see the issue.
My expectation is that the executable spawned by `swift run` does NOT contain these variables (unless they were already present in the caller’s environment).
Steps to reproduce:
open the attached sample project
run ./dump_environments.sh
observe the extra environment variables
The text was updated successfully, but these errors were encountered: