-
Notifications
You must be signed in to change notification settings - Fork 728
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src/goDebugFactory,goDebugConfiguration: adjust env computation
When spawning delve, the extension wants to run it in the environment computed by merging 1. process.env 2. go.toolsEnvVars from settings.json 3. envFile from launch.json 4. env from launch.json This is true for both when we use legacy debug adapter and dlv dap mode. For some time, we did this environment variable merging from goDebugConfigurationProvider. Recently in https://go-review.googlesource.com/c/vscode-go/+/349749, we changed this logic for dlv dap mode - goDebugConfigurationProvider merges only 3 and 4 and stuff the result to the launch configuration. - from DelveDAPOutputAdapter (thin adapter), we merge 1, 2, and the info from the launch configuration (3, 4) and use the result when spawning the `dlv dap` process. We made the change because including 1 and 2 in the launch configuration resulted in transmitting all the process.env over the wire as launch parameter unncessarily, and that made users reluctant to share their debug traces or, made users accidentally share too much info including sensitive information. Now with the changes to support the `console` mode, the extension delegates spawning of `dlv dap` to the VS Code using VS Code's RunInTerminal implementation. Before this change, we sent environment variables merging all 1, 2, 3, and 4 as RunInTerminal's env property. It turned out VS Code's RunInTerminal formulates the final command to run using the `env` command (in Unix) and lists all the environment variables. As a result, including process.env (1) in the env property is problematic: - The terminal is crowded and hurts user experience. - It may result in a long command and that will suffer from problems like microsoft/vscode#134324 Usually, users add only a handful of extra environment variables in the launch configuration and the go.toolsEnvVars configuration. And most likely, the terminal will inherit most of the process.env so we don't need to carry them around. This change thus skips process.env in RunInTerminal's env property, but includes only 2, and 3, 4 from goDebugConfigurationProvider. We still need to merge 1 when the extension spawns 'dlv dap' without RunInTerminal mode, because Node.JS child_process requires all env variables should be included. Updates #124 Change-Id: I33ad5490c6d11a3afb0e569563689be08aefcd06 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/361101 Trust: Hyang-Ah Hana Kim <hyangah@gmail.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> Reviewed-by: Suzy Mueller <suzmue@golang.org>
- Loading branch information
Showing
5 changed files
with
35 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters