Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: Improve shutdown procedure of ssh, portforward, wgtunnel cmds#3354

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mafredri merged 3 commits intomainfrommafredri/command-closure
Aug 2, 2022

Conversation

mafredri
Copy link
Member

We could turn it into a practice to wrapcmd.Context() so that we have
more fine-grained control of cancellation. Sometimes in tests we may be
running commands with a context that is never canceled.

Related to#3221

We could turn it into a practice to wrap `cmd.Context()` so that we havemore fine-grained control of cancellation. Sometimes in tests we may berunning commands with a context that is never canceled.Related to#3221
@mafredrimafredri self-assigned thisAug 2, 2022
@mafredrimafredri requested a review froma teamAugust 2, 2022 13:40
@@ -224,13 +236,17 @@ func ssh() *cobra.Command {

sshSession.Stdin = cmd.InOrStdin()
sshSession.Stdout = cmd.OutOrStdout()
sshSession.Stderr = cmd.OutOrStdout()
sshSession.Stderr = cmd.ErrOrStderr()
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is a drive-by change I did. It seemed wrong but perhaps I didn't understand the purpose?

kylecarbs reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Seems reasonable to me!

Copy link
Member

@kylecarbskylecarbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'm in-between on whether this is desired or not, but I suppose it is. It seems weird to not use the command context directly, but then the caller (like our tests) is responsible for canceling it, which is even weirder I suppose.

@mafredri
Copy link
MemberAuthor

I'm in-between on whether this is desired or not, but I suppose it is. It seems weird to not use the command context directly, but then the caller (like our tests) is responsible for canceling it, which is even weirder I suppose.

We're still inheriting it, so in that sense we're still using it. I think this change can make more sense if we consider other scenarios, like adding tracing to the commands. We'd want to ensure that the context we're passing along contains the tracing information which means we shouldn't be accessing the command context directly.

kylecarbs reacted with thumbs up emoji

@mafredrimafredri merged commit83c63d4 intomainAug 2, 2022
@mafredrimafredri deleted the mafredri/command-closure branchAugust 2, 2022 14:45
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@kylecarbskylecarbskylecarbs approved these changes

Assignees

@mafredrimafredri

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@mafredri@kylecarbs

[8]ページ先頭

©2009-2025 Movatter.jp