Ignore closeOnExit when a conn. moves from Connecting to Failed#10263
Merged
Ignore closeOnExit when a conn. moves from Connecting to Failed#10263
Conversation
ConptyConnection has two different failure modes: 1. We failed to initialize the pseudoconsole or create the process 2. The process exited with an error code. Until this commit, they were treated the same way: closeOnExit=always would force the pane/tab to be destroyed. This was very bad in case 1, where we would display a (possibly useful) error message and then immediately close the window. This was made even worse by the change in #10045. We removed startingDirectory validation and promoted it to an error message (so that we could eventually let the connection handle startingDirectory in its own way.) This of course revealed that a number of users had set invalid starting directories… and those users included some who set closeOnExit to always. Boom: instant "terminal opens and crashes"¹ ¹ It only looks like a crash; it's actually _technically_ functioning properly. Closes #10225.
zadjii-msft
approved these changes
May 28, 2021
lhecker
approved these changes
May 28, 2021
| // Move our control, guid into the first one. | ||
| // Move the new guid, control into the second. | ||
| _firstChild = std::make_shared<Pane>(_profile.value(), _control); | ||
| _firstChild->_connectionState = std::exchange(_connectionState, ConnectionState::NotConnected); |
Member
There was a problem hiding this comment.
Is it just me or is it kinda hacky that this isn't part of the/a constructor?
Member
Author
There was a problem hiding this comment.
I rather think the design of Pane leaves a lot to be desired; there are a lot of properties that "move" between parent and leaf panes. The ideal design is one that doesn't require us to move state at all. I'd rather not spend too much effort on an already-bad solution 😄
This was referenced Jun 1, 2021
Closed
DHowett
added a commit
that referenced
this pull request
Jun 1, 2021
ConptyConnection has two different failure modes: 1. We failed to initialize the pseudoconsole or create the process 2. The process exited with an error code. Until this commit, they were treated the same way: closeOnExit=always would force the pane/tab to be destroyed. This was very bad in case 1, where we would display a (possibly useful) error message and then immediately close the window. This was made even worse by the change in #10045. We removed startingDirectory validation and promoted it to an error message (so that we could eventually let the connection handle startingDirectory in its own way.) This of course revealed that a number of users had set invalid starting directories… and those users included some who set closeOnExit to always. Boom: instant "terminal opens and crashes"¹ In this commit, we introduce detection for a connection that fails before it's been established. When that happens, we will ignore the user's closeOnExit mode. ¹ It only looks like a crash; it's actually _technically_ functioning properly. Closes #10225. (cherry picked from commit 31d78dc)
|
🎉 Handy links: |
|
🎉 Handy links: |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ConptyConnection has two different failure modes:
Until this commit, they were treated the same way: closeOnExit=always
would force the pane/tab to be destroyed. This was very bad in case 1,
where we would display a (possibly useful) error message and then
immediately close the window.
This was made even worse by the change in #10045. We removed
startingDirectory validation and promoted it to an error message (so
that we could eventually let the connection handle startingDirectory in
its own way.) This of course revealed that a number of users had set
invalid starting directories… and those users included some who set
closeOnExit to always. Boom: instant "terminal opens and crashes"¹
¹ It only looks like a crash; it's actually technically functioning
properly.
Closes #10225.