-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Terminal preview does not accept environment variables from parent process #15496
Comments
Ah, indeed! With WT transitioning to a long-lived single process model like Explorer, we're evaluating a stance that all tabs and panes receive a completely new environment block on creation. That's the only way--apart from a risky three-way merge--to ensure that applications get up-to-date environment variables without requiring everything run through Terminal to actively reconstruct and merge its own envrionment. In short, inheritance is in tension with #1125 and #7239. The move to that single-process model has made it somewhat difficult to maintain a chain of custody for the env. block in any way other than to construct a new one! There is probably something we could do with the |
This was already a bit "wacky" for window grouping, even in Preview 1.16 (and 1.15, 1.14, ...):
has different environment block behavior than...
Between the two, they are now at the very least consistent as of 1.18 😄 |
@ChrisKnue-MSFT Thanks for filing! Going to close this based on Dustin's responses. |
We have hundreds of developers relying on windows terminal for running about 6 tabs of applications to run our platform. Not propagating environment variables is a pretty large breaking change--I hope you will provide a workaround for passing environment variables to new tabs or at least give us some time to rearchitect things before the preview becomes the standard version. @DHowett |
(I'm gonna reopen this and mark it for discussion among the team.) There's roughly one quarter of a year until this ships broadly, which is the big win we get from having a preview channel 😄 |
quick notes
|
Maybe the |
Argument for
Argument against:
|
Notes from discussion: We're gonna approach this as many bits:
At the end of this:
working notes
Related:
Footnotes
|
…oo (#15897) This PR is a few things: * part the first: Convert the `compatibility.reloadEnvironmentVariables` setting to a per-profile one. * The settings should migrate it from the user's old global place to the new one. * We also added it to "Profile>Advanced" while I was here. * Adds a new pair of commandline flags to `new-tab` and `split-pane`: `--inheritEnvironment` / `--reloadEnvironment` * On `wt` launch, bundle the entire environment that `wt` was spawned with, and put it into the `Remoting.CommandlineArgs`, and give them to the monarch (and ultimately, down to `TerminalPage` with the `AppCommandlineArgs`). DO THIS ALWAYS. * As a part of this, we’ll default to _reloading_ if there’s no explicit commandline set, and _inheriting_ if there is. * For example, `wt -- cmd` would inherit, and `wt -p “Command Prompt”` would reload.[^1] * This is a little wacky, but we’re trying to separate out the intentions here: * `wt -- cmd` feels like “I want to run cmd.exe (in a terminal tab)”. That feels like the user would _like_ environment variables from the calling process. They’re doing something more manual, so they get more refined control over it. * `wt` (or `wt -p “Command Prompt”`) is more like, “I want to run the Terminal (or, my Command Prompt profile) using whatever the Terminal would normally do”. So that feels more like a situation where it should just reload by default. (Of course, this will respect their settings here) ## References and Relevant Issues #15496 (comment) has more notes. ## Detailed Description of the Pull Request / Additional comments This is so VERY much plumbing. I'll try to leave comments in the interesting parts. ## PR Checklist - [x] This is not _all_ of #15496. We're also going to do a `-E foo=bar` arg on top of this. - [x] Tests added/passed - [x] Schema updated [^1]: In both these cases, plus the `environment` setting, of course.
Actually, y'know what. I'm gonna mark this as closed by #15897, and then fork off the |
…oo (#15897) This PR is a few things: * part the first: Convert the `compatibility.reloadEnvironmentVariables` setting to a per-profile one. * The settings should migrate it from the user's old global place to the new one. * We also added it to "Profile>Advanced" while I was here. * Adds a new pair of commandline flags to `new-tab` and `split-pane`: `--inheritEnvironment` / `--reloadEnvironment` * On `wt` launch, bundle the entire environment that `wt` was spawned with, and put it into the `Remoting.CommandlineArgs`, and give them to the monarch (and ultimately, down to `TerminalPage` with the `AppCommandlineArgs`). DO THIS ALWAYS. * As a part of this, we’ll default to _reloading_ if there’s no explicit commandline set, and _inheriting_ if there is. * For example, `wt -- cmd` would inherit, and `wt -p “Command Prompt”` would reload.[^1] * This is a little wacky, but we’re trying to separate out the intentions here: * `wt -- cmd` feels like “I want to run cmd.exe (in a terminal tab)”. That feels like the user would _like_ environment variables from the calling process. They’re doing something more manual, so they get more refined control over it. * `wt` (or `wt -p “Command Prompt”`) is more like, “I want to run the Terminal (or, my Command Prompt profile) using whatever the Terminal would normally do”. So that feels more like a situation where it should just reload by default. (Of course, this will respect their settings here) #15496 (comment) has more notes. This is so VERY much plumbing. I'll try to leave comments in the interesting parts. - [x] This is not _all_ of #15496. We're also going to do a `-E foo=bar` arg on top of this. - [x] Tests added/passed - [x] Schema updated [^1]: In both these cases, plus the `environment` setting, of course. (cherry picked from commit 59248de) Service-Card-Id: 90383402 Service-Version: 1.18
Windows Terminal version
1.18.1421.0
Windows build number
10.0.22631.0
Other Software
No response
Steps to reproduce
Create a batch file "test.bat" with contents
open cmd terminal profile
run
SET TEST=wow
run
wt test.bat
run
./test.bat
Expected Behavior
New terminal window should open up with output (this is the behavior in 1.16)
Then outputs in parent window
Actual Behavior
New terminal window is opened with output
Then outputs in parent window
The text was updated successfully, but these errors were encountered: