Skip to content

feat: enhance SSH command execution with cancellation and wait delay#617

Merged
creativeprojects merged 3 commits intomasterfrom
client-server-disconnection
Apr 2, 2026
Merged

feat: enhance SSH command execution with cancellation and wait delay#617
creativeprojects merged 3 commits intomasterfrom
client-server-disconnection

Conversation

@creativeprojects
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 2, 2026 09:16
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 74.35897% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.39%. Comparing base (70fd44b) to head (0bdca97).
⚠️ Report is 2 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
serve.go 0.00% 6 Missing ⚠️
ssh/internal_client.go 91.67% 1 Missing and 1 partial ⚠️
ssh/openssh_client.go 77.78% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #617      +/-   ##
==========================================
+ Coverage   80.34%   80.39%   +0.05%     
==========================================
  Files         150      150              
  Lines       11755    11786      +31     
==========================================
+ Hits         9444     9475      +31     
- Misses       1826     1827       +1     
+ Partials      485      484       -1     
Flag Coverage Δ
unittests 78.62% <0.00%> (-0.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves shutdown/cancellation behavior for SSH-based remote command execution by propagating OS signal cancellation through contexts and tuning how ssh subprocesses are terminated.

Changes:

  • Customize os/exec.Cmd cancellation for OpenSSH runs by sending os.Interrupt and adding a WaitDelay.
  • Update sendProfileCommand to use a signal-cancelled context for Connect/Run, while ensuring Close still runs with a non-cancelled context.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
ssh/openssh_client.go Add custom exec cancellation behavior (SIGINT + wait delay) for OpenSSH command runs.
serve.go Thread a signal-cancelled context into SSH Connect/Run and adjust Close to avoid cancellation interference.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ssh/openssh_client.go
Comment thread serve.go
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ssh/openssh_client.go Outdated
Comment thread ssh/openssh_client.go
Comment thread ssh/internal_client.go
Comment thread ssh/client_test.go
@creativeprojects creativeprojects merged commit b6693a3 into master Apr 2, 2026
8 checks passed
@creativeprojects creativeprojects deleted the client-server-disconnection branch April 2, 2026 12:45
@creativeprojects creativeprojects added this to the v0.33.0 milestone Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants