Implement ConnectionState and closeOnExit=graceful/always/never#3623
Implement ConnectionState and closeOnExit=graceful/always/never#3623DHowett-MSFT merged 18 commits intomasterfrom
Conversation
commit c36b2482c04070529cbb009b09ec60cea70da8bd Merge: 4d6e975 c274b38 Author: Dustin Howett <duhowett@microsoft.com> Date: Fri Nov 8 14:16:44 2019 -0800 Merge remote-tracking branch 'github/master' into dev/duhowett/closeonexit commit 4d6e975 Author: Dustin Howett <duhowett@microsoft.com> Date: Wed Nov 6 15:49:38 2019 -0800 further hax commit 1950413 Author: Dustin Howett <duhowett@microsoft.com> Date: Wed Nov 6 07:30:32 2019 -0800 hacks: try to implement the state thing commit 22dd029 Merge: 5763be3 357e835 Author: Dustin Howett <duhowett@microsoft.com> Date: Wed Nov 6 15:15:21 2019 -0800 Merge remote-tracking branch 'github/master' into HEAD commit 5763be3 Author: Dustin Howett <duhowett@microsoft.com> Date: Tue Nov 5 17:47:22 2019 -0800 Spec: propose an evolution of closeOnExit and TerminalConnection
f8fae5a to
17f1025
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
zadjii-msft
left a comment
There was a problem hiding this comment.
I'm 27/32, and it's 5pm here, so unfortunately this is going to have to wait till monday from me :(
Nothing major so far though
| std::lock_guard<std::mutex> stateLock{ _stateMutex }; | ||
| // dark magic: this is a C++17 fold expression that expands into | ||
| // state == 1 || state == 2 || state == 3 ... | ||
| return (... || (_connectionState == args)); |
There was a problem hiding this comment.
I still don't understand what this dark magic does. is it equivalent to the following:
_connectionState == args[0] || _connectionState == args[1] || _connectionState == args[2] ...(if you could index into the params like that?)
There was a problem hiding this comment.
YES! Exactly.
And the one above it is like
typeof(args[0]) == ConnectionState && typeof(args[1] == ConnectionState) && ...
There was a problem hiding this comment.
I'm going to expand these since i have to make a comment revision anyway
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
zadjii-msft
left a comment
There was a problem hiding this comment.
I suppose none of my comments are more than nits.
| // This should result in our termination. | ||
| if (_transitionToState(ConnectionState::Closed)) | ||
| { | ||
| _state = State::NoConnect; |
There was a problem hiding this comment.
Should we just remove the AzureState::NoConnect state entirely now?
There was a problem hiding this comment.
I'm working on the AZ conn in my free time, I'll defer this to then.
There was a problem hiding this comment.
er defer this to that work
| // Subscribe to the connection's disconnected event and call our connection closed handlers. | ||
| _connection.TerminalDisconnected([=]() { | ||
| _connectionClosedHandlers(); | ||
| _connectionStateChangedRevoker = _connection.StateChanged(winrt::auto_revoke, [weakThis = get_weak()](auto&& /*s*/, auto&& /*v*/) { |
There was a problem hiding this comment.
This looks like a pattern we should probably be using in other places, right? Where the event handler doesn't capture a strong ref to the handler object? (maybe we should file a CodeHealth task for this)
There was a problem hiding this comment.
Yes, absolutely.
|
🎉 Handy links: |
|
I curiously tried the new When opening a new tab with Build Script, the script |
|
if I recall correctly, You want |
|
You are absolutely right, thank you! |
Summary of the Pull Request
This pull request implements the new
ITerminalConnection::ConnectionStateinterface (enum, event) and connects it through TerminalControl to Pane, Tab and App as specified in #2039. It does so to implementcloseOnExit=gracefulin addition to the other two normal CoE types.It also:
CascadiaSettingsthrough a function that looks it up by using the current Xaml application'sAppLogic.:crazy_eyes:AzureConnection. This required moving the Azure connection's state machine to use another enum name (oops).WINRT_CALLBACK, a oneshot callback likeTYPED_EVENT._connectingand_closingmembers with just one uberstate.References
Specification is in PR #2039.
PR Checklist