[PR #3623] [MERGED] Implement ConnectionState and closeOnExit=graceful/always/never #25451

Open
opened 2026-01-31 09:09:36 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/3623
Author: @DHowett-MSFT
Created: 11/19/2019
Status: Merged
Merged: 11/25/2019
Merged by: @DHowett-MSFT

Base: masterHead: dev/duhowett/closeonexit


📝 Commits (10+)

📊 Changes

32 files changed (+551 additions, -280 deletions)

View changed files

📝 doc/cascadia/SettingsSchema.md (+1 -1)
📝 doc/cascadia/profiles.schema.json (+15 -3)
📝 src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp (+66 -0)
📝 src/cascadia/TerminalApp/AppLogic.cpp (+7 -0)
📝 src/cascadia/TerminalApp/AppLogic.h (+1 -0)
📝 src/cascadia/TerminalApp/AzureCloudShellGenerator.cpp (+0 -1)
📝 src/cascadia/TerminalApp/CascadiaSettings.cpp (+16 -0)
📝 src/cascadia/TerminalApp/CascadiaSettings.h (+2 -0)
📝 src/cascadia/TerminalApp/Pane.cpp (+34 -15)
📝 src/cascadia/TerminalApp/Pane.h (+3 -3)
📝 src/cascadia/TerminalApp/Profile.cpp (+67 -9)
📝 src/cascadia/TerminalApp/Profile.h (+13 -3)
📝 src/cascadia/TerminalApp/Tab.cpp (+2 -3)
📝 src/cascadia/TerminalApp/Tab.h (+1 -1)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+1 -1)
📝 src/cascadia/TerminalApp/defaults.json (+2 -2)
📝 src/cascadia/TerminalConnection/AzureConnection.cpp (+62 -96)
📝 src/cascadia/TerminalConnection/AzureConnection.h (+8 -13)
src/cascadia/TerminalConnection/ConnectionStateHolder.h (+85 -0)
📝 src/cascadia/TerminalConnection/ConptyConnection.cpp (+89 -49)

...and 12 more files

📄 Description

Summary of the Pull Request

This pull request implements the new ITerminalConnection::ConnectionState interface (enum, event) and connects it through TerminalControl to Pane, Tab and App as specified in #2039. It does so to implement closeOnExit = graceful in addition to the other two normal CoE types.

It also:

  • ... exposes the singleton CascadiaSettings through a function that looks it up by using the current Xaml application's AppLogic.
    • In so doing, we've broken up the weird runaround where App tells TerminalSettings to CloseOnExit and then later another part of App asks TerminalControl to tell it what TerminalSettings said App told it earlier. :crazy_eyes:
  • ... wires up a bunch of connection state points to AzureConnection. This required moving the Azure connection's state machine to use another enum name (oops).
  • ... ships a helper class for managing connection state transitions.
  • ... contains a bunch of template magic.
  • ... contains a TODO (whoops, sorry, if you point it out you'll be removed from the selfhost program)
  • ... introduces WINRT_CALLBACK, a oneshot callback like TYPED_EVENT.
  • ... replaces a bunch of disparate _connecting and _closing members with just one uberstate.

References

Specification is in PR #2039.

PR Checklist


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/3623 **Author:** [@DHowett-MSFT](https://github.com/DHowett-MSFT) **Created:** 11/19/2019 **Status:** ✅ Merged **Merged:** 11/25/2019 **Merged by:** [@DHowett-MSFT](https://github.com/DHowett-MSFT) **Base:** `master` ← **Head:** `dev/duhowett/closeonexit` --- ### 📝 Commits (10+) - [`f2db361`](https://github.com/microsoft/terminal/commit/f2db361681434689210d3a87b9fff623c89b44f0) Squashed commit of the following: - [`f3a010b`](https://github.com/microsoft/terminal/commit/f3a010b21bd3d54920f4faf0bad6be1d11456896) Gotta admit, I don't love it. - [`5a11dcf`](https://github.com/microsoft/terminal/commit/5a11dcf1e8d59d73d34e48d9ce118ad27a3ac610) Add a connection state helper - [`11b557f`](https://github.com/microsoft/terminal/commit/11b557f7bdb559824a79ea6b6d7ec745bedaa24e) xyxy - [`0577fe0`](https://github.com/microsoft/terminal/commit/0577fe0a7ee546b1e1d07b29d4bab4499eff75d7) doc comments - [`410bf59`](https://github.com/microsoft/terminal/commit/410bf59079a5f3782ecaa01c7cef575019baa4b6) invoke-codeformat - [`4661db8`](https://github.com/microsoft/terminal/commit/4661db8ec57b2aebf1d166dc271c72352e880668) do the schema dance - [`1d537ae`](https://github.com/microsoft/terminal/commit/1d537aef82bc0cc4d3d347c59f72e2da4f8536ca) and the doc? - [`f38b736`](https://github.com/microsoft/terminal/commit/f38b736aae0717f419dc78f3ada95102f80743f5) couple more azure fail points - [`270fb73`](https://github.com/microsoft/terminal/commit/270fb73cb5b9bc7eea518b38382e2bd8acfea78b) I guess serialize the closeyboi? ### 📊 Changes **32 files changed** (+551 additions, -280 deletions) <details> <summary>View changed files</summary> 📝 `doc/cascadia/SettingsSchema.md` (+1 -1) 📝 `doc/cascadia/profiles.schema.json` (+15 -3) 📝 `src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp` (+66 -0) 📝 `src/cascadia/TerminalApp/AppLogic.cpp` (+7 -0) 📝 `src/cascadia/TerminalApp/AppLogic.h` (+1 -0) 📝 `src/cascadia/TerminalApp/AzureCloudShellGenerator.cpp` (+0 -1) 📝 `src/cascadia/TerminalApp/CascadiaSettings.cpp` (+16 -0) 📝 `src/cascadia/TerminalApp/CascadiaSettings.h` (+2 -0) 📝 `src/cascadia/TerminalApp/Pane.cpp` (+34 -15) 📝 `src/cascadia/TerminalApp/Pane.h` (+3 -3) 📝 `src/cascadia/TerminalApp/Profile.cpp` (+67 -9) 📝 `src/cascadia/TerminalApp/Profile.h` (+13 -3) 📝 `src/cascadia/TerminalApp/Tab.cpp` (+2 -3) 📝 `src/cascadia/TerminalApp/Tab.h` (+1 -1) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+1 -1) 📝 `src/cascadia/TerminalApp/defaults.json` (+2 -2) 📝 `src/cascadia/TerminalConnection/AzureConnection.cpp` (+62 -96) 📝 `src/cascadia/TerminalConnection/AzureConnection.h` (+8 -13) ➕ `src/cascadia/TerminalConnection/ConnectionStateHolder.h` (+85 -0) 📝 `src/cascadia/TerminalConnection/ConptyConnection.cpp` (+89 -49) _...and 12 more files_ </details> ### 📄 Description ## Summary of the Pull Request This pull request implements the new `ITerminalConnection::ConnectionState` interface (enum, event) and connects it through TerminalControl to Pane, Tab and App as specified in #2039. It does so to implement `closeOnExit` = `graceful` in addition to the other two normal CoE types. It also: * ... exposes the singleton `CascadiaSettings` through a function that looks it up by using the current Xaml application's `AppLogic`. * In so doing, we've broken up the weird runaround where App tells TerminalSettings to CloseOnExit and then later another part of App _asks TerminalControl_ to tell it what TerminalSettings said App told it earlier. `:crazy_eyes:` * ... wires up a bunch of connection state points to `AzureConnection`. This required moving the Azure connection's state machine to use another enum name (oops). * ... ships a helper class for managing connection state transitions. * ... contains a bunch of template magic. * ... contains a TODO (whoops, sorry, if you point it out you'll be removed from the selfhost program) * ... introduces `WINRT_CALLBACK`, a oneshot callback like `TYPED_EVENT`. * ... replaces a bunch of disparate `_connecting` and `_closing` members with just one uberstate. ## References Specification is in PR #2039. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #2563, Closes #982 * [x] CLA * [ ] Tests added/passed * [x] Requires documentation to be updated * [x] I've discussed this with core contributors already. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:09:36 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#25451