-
Notifications
You must be signed in to change notification settings - Fork 352
[Swift REPL] Inherit the environment for the Swift REPL #9853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -188,23 +188,18 @@ lldb::REPLSP SwiftREPL::CreateInstanceFromDebugger(Status &err, | |
| // breakpoint above, it better | ||
| // say it is internal | ||
|
|
||
| lldb_private::ProcessLaunchInfo launch_info; | ||
| llvm::StringRef target_settings_argv0 = target_sp->GetArg0(); | ||
|
|
||
| if (target_sp->GetDisableASLR()) | ||
| launch_info.GetFlags().Set(eLaunchFlagDisableASLR); | ||
|
|
||
| if (target_sp->GetDisableSTDIO()) | ||
| launch_info.GetFlags().Set(eLaunchFlagDisableSTDIO); | ||
| lldb_private::ProcessLaunchInfo launch_info = | ||
| target_sp->GetProcessLaunchInfo(); | ||
|
|
||
| // FIXME: Why is this necessary? Document or change once we know the answer. | ||
| llvm::StringRef target_settings_argv0 = target_sp->GetArg0(); | ||
| if (!target_settings_argv0.empty()) { | ||
| launch_info.GetArguments().AppendArgument(target_settings_argv0); | ||
| launch_info.SetExecutableFile(exe_module_sp->GetPlatformFileSpec(), false); | ||
| } else { | ||
| launch_info.SetExecutableFile(exe_module_sp->GetPlatformFileSpec(), true); | ||
| } | ||
|
|
||
|
||
| launch_info.GetEnvironment() = target_sp->GetTargetEnvironment(); | ||
| debugger.SetAsyncExecution(false); | ||
| err = target_sp->Launch(launch_info, nullptr); | ||
| debugger.SetAsyncExecution(true); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| // Test inheriting environment variables in the REPL. | ||
| // REQUIRES: system-darwin | ||
| // REQUIRES: swift | ||
|
|
||
| // RUN: FOO=foo %lldb --repl -O 'settings set target.inherit-env true' < %s 2>&1 \ | ||
| // RUN: | FileCheck %s | ||
|
|
||
| import Foundation | ||
| ProcessInfo.processInfo.environment["FOO"] | ||
| // CHECK: $R0: String? = "foo" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this dead code anyway?