-
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
Feature Request: Terminal should listen for the WM_SETTINGCHANGE for environment variable updates #1125
Comments
Related discussion in ConEmu. Maximus5/ConEmu#468 |
Opening a new tab should definitely inherit from the current system environment. |
<This was a kind of unfocused train of thought, though I'm happy with the conclusion at the bottom. leaving my own notes so I can remember whenever I get back to this> Huh, this might be a bit trickier than I thought. We could call Though, if the user launched the Terminal from one process with some extra variables set, and expected it to inherit variables from the parent process, then we probably shouldn't blow away the env vars for the first tab that's created. I suppose we could only do this refreshing of the environment block when we do get a I guess the most unified solution would be to just use a fresh environment block for all connections created after startup. That would at least be consistent behavior. We'd probably want to wait for #4023 to merge first, and set some internal flag to use a fresh env block, only after all the startup actions are processed. Then we wouldn't even need to use |
nit: I would suggest the current user environment. explorer.exe does this correctly when launching new processes, so I hope it's not too complicated. |
Make sure when we reload this, we also reload settings. That'll probably fix the keyboard issue in 4735. |
I had almost filed a bug with Node.js, then almost filed a bug with PowerShell, until I finally found this ticket. I had found the same workaround that @dexeonify mentioned. Yes, I can see putting that workaround in my PowerShell Is this on any team's schedule to address? I think most people here would agree that just reloading |
I've read most of the comments here, and I still don't get why closing the entire Microsoft Terminal instance and restarting it doesn't result in the latest |
It does
|
It sure shouldn't be. There might be a lasting RuntimeBroker.exe, but I don't think that should have anything to do with it. Closing all the Terminal windows (s.t. there are no windowsterminal.exe's running) should cause the next Terminal launch to have a fresh env block. |
But alas … it doth not. 😒 I see various "Console Windows Host" entries in Task Manager. Would that have anything to do with it? If so, does that mean there's yet another bug that Microsoft Terminal isn't shutting down properly? |
Now this problem more seriously. |
I can start a new cmd from windows start menu and my user PATH is loaded |
Thanks for the feedback! As you'll notice, this issue is currently open. We've got an idea how to solve this with the work being done in #12516, now we just need to book some time to polish that out. If anyone is interested in helping out, I'd be more than happy to help give an outline of what I was planning on doing with that thread. It'll unfortunately be a few months before I can loop back on that, so if folks want this sooner than that, I'd appreciate the help |
Okay, if I was gonna do this, here's how I'd approach this. I'd make it two PRs. One to finish building the helper class, and one to actually integrate it into the Teminal
I honestly think that's it. That should just work. We shouldn't need to listen for env var updates, because we should just get a fresh block everytime. And then we can handle ourselves the follow-up of merging #9287 with the code written to solve this issue. |
AFAIK, it was pretty much done except for me updating the spell check and perhaps adding more tests. It probably just needs a spit shine then check it in and call anything else a bug, @zadjii-msft. |
Ah, plus me imploring you to "please stop inheriting from |
Adds a global setting `compatibility.reloadEnvironmentVariables` with a default value of `true`. When set, during connection creation a new environment block will be generated to ensure it has the latest environment variables. Closes #1125 Co-authored-by: Leonard Hecker <lhecker@microsoft.com>
Summary of the new feature/enhancement
When I install an app that updates the path or I update the path manually, it isn't enough to kill an individual tab in the Terminal and start a new one. The new tab still inherits the old, unchanged environment variable values. This means I have to kill/restart the Terminal and lose all my tabs.
Proposed technical implementation details (optional)
Add a Windows message handler for
WM_SETTINGCHANGE
and update the Terminal process's environment block so that any new tabs get the updated environment variables.The text was updated successfully, but these errors were encountered: