Swallow SIGINT while running kubectl#380
Merged
bboston7 merged 1 commit intostellar:mainfrom Apr 29, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts ConnectToCluster’s internal kubectl invocation so Ctrl+C during kubectl auth whoami cancels kubectl without terminating the parent F# process, allowing the code to proceed to restoring the original id-token when refresh fails.
Changes:
- Temporarily installs a
Console.CancelKeyPresshandler whilekubectlis running to swallowCtrl+Cin the parent process. - Ensures the handler is removed via
try/finallyafterkubectlcompletes or times out.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bboston7
approved these changes
Apr 29, 2026
0389da9 to
1dec98d
Compare
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.
Sometimes I realize that my local network is set up wrong such that the authentication flow can't complete. While it is possible to just wait the minute for the pre-existing code to detect this, I'd prefer to be able to just
CTRL+Ccancel thekubectl auth whoamithat does the token refresh. Before this PR,CTRL+Cwould also stop the running F# code, so we wouldn't run the command that attempts to restore the original id-token.