-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Use a "virtual CWD" for each terminal window #15280
Merged
Merged
Conversation
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
In the dirtiest way possible, this seems to work for most "start with this CWD" scenarios.
lhecker
reviewed
May 4, 2023
lhecker
approved these changes
May 4, 2023
DHowett
requested changes
May 11, 2023
lhecker
approved these changes
May 12, 2023
lhecker
reviewed
May 12, 2023
src/types/utils.cpp
Outdated
// with `~` or `/`. | ||
const bool looksLikeLinux = | ||
resultPath.size() >= 1 && | ||
(resultPath[0] == L'~' || resultPath[0] == L'/'); |
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.
FYI I wouldn't use gsl::at
, because it's poorly integrated into MSVC. til::at
would be sufficient IMO, but .at(0)
would work just as well.
DHowett
approved these changes
May 12, 2023
When you put stuff in Utils, you gotta make sure it passes audit! |
DHowett
pushed a commit
that referenced
this pull request
May 12, 2023
Before process model v3, each Terminal window was running in its own process, each with its own CWD. This allowed `startingDirectory: .` to work relative to the terminal's own CWD. However, now all windows share the same process, so there can only be one CWD. That's not great - folks who right-click "open in terminal", then "Use parent process directory" are only ever going to be able to use the CWD of the _first_ terminal opened. This PR remedies this issue, with a theory we had for another issue. Essentially, we'll give each Terminal window a "virtual" CWD. The Terminal isn't actually in that CWD, the terminal is in `system32`. This also will prevent the Terminal from locking the directory it was originally opened in. * Closes #5506 * There wasn't a 1.18 issue for "Use parent process directory is broken" yet, presumably selfhosters aren't using that feature * Related to #14957 Many more notes on this topic in #4637 (comment) > **Warning** > ## Breaking change‼️ This will break a profile like ```json { "commandline": "media-test.exe", "name": "Use CWD for media-test", "startingDirectory": "." }, ``` if the user right-clicks "open in terminal", then attempts to open that profile. There's some theoretical work we could do in a follow up to fix this, but I'm inclined to say that relative paths for `commandline`s were already dangerous and should have been avoided. (cherry picked from commit 5c08a86) Service-Card-Id: 89180224 Service-Version: 1.18
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area-Commandline
wt.exe's commandline arguments
Area-Remoting
Communication layer between windows. Often for windowing behavior, quake mode, etc.
Issue-Bug
It either shouldn't be doing this or needs an investigation.
Priority-1
A description (P1)
Product-Terminal
The new Windows Terminal.
Severity-Blocking
We won't ship a release like this! No-siree.
zBugBash-Consider
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before process model v3, each Terminal window was running in its own process, each with its own CWD. This allowed
startingDirectory: .
to work relative to the terminal's own CWD. However, now all windows share the same process, so there can only be one CWD. That's not great - folks who right-click "open in terminal", then "Use parent process directory" are only ever going to be able to use the CWD of the first terminal opened.This PR remedies this issue, with a theory we had for another issue. Essentially, we'll give each Terminal window a "virtual" CWD. The Terminal isn't actually in that CWD, the terminal is in
system32
. This also will prevent the Terminal from locking the directory it was originally opened in.Many more notes on this topic in #4637 (comment)
This will break a profile like
if the user right-clicks "open in terminal", then attempts to open that profile. There's some theoretical work we could do in a follow up to fix this, but I'm inclined to say that relative paths for
commandline
s were already dangerous and should have been avoided.