Commit 79d7505
committed
[Swift REPL] Inherit the environment for the Swift REPL
The Swift REPL was had rolling the ProcessLaunchInfo instead of using
the one already setup by the target. While populating the launch info,
it used `Target::GetTargetEnvironment()` which only looks at the
corresponding setting, and ignoring the `inherit-environment` setting.
The alternative of calling `Target::GetInheritedEnvironment` is also
wrong, because that has the inverse problem: it only inherits the
environment and doesn't merge it with the target's environment
variables. The solution is to use `Target::GetProcessLaunchInfo` which
populates the launch info correctly.
Propagating the environment correctly is particularly important on
Windows where `Path` needs to be passed to the inferior to allow
`LoadLibraryW(L"swiftCore.dll")` to succeed. Without this patch, the
library is not found and the inferior exits terminating the REPL
instance.
- Fixes: llvm#9551
- Will fix swiftlang/swift#76702 and swiftlang/swift#70005 with a
corresponding driver change to set `inherit-environment` when invoking
the REPL.
rdar://1375224561 parent 29770a5 commit 79d7505
File tree
2 files changed
+14
-9
lines changed- lldb
- source/Plugins/ExpressionParser/Swift
- test/Shell/SwiftREPL
2 files changed
+14
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
| 191 | + | |
| 192 | + | |
199 | 193 | | |
| 194 | + | |
| 195 | + | |
200 | 196 | | |
201 | 197 | | |
202 | 198 | | |
203 | 199 | | |
204 | 200 | | |
205 | 201 | | |
206 | 202 | | |
207 | | - | |
208 | 203 | | |
209 | 204 | | |
210 | 205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments