Skip to content

Commit 8b094c3

Browse files
committed
Add SshCommand.ExecuteAsync
After the previous change (sshnet#1423), this basically entails swapping out the IAsyncResult for a TaskCompletionSource and hooking up the cancellation/timeout logic. As with the prior Begin/End pattern, the initiation of the command (SendExecRequest) happens synchronously, so there's a bit of room for improvement there, but otherwise it is the Task-based async that we know and like. I chose to make it void (Task)- returning instead of string like in the existing overloads, so that OutputStream is not automatically consumed (and encoded as a string) when that may not be desired. As in sshnet#650, I was initially considering changing the other overloads to be void-returning as well, but decided that it was not worth the break since most people will probably want to change over to ExecuteAsync anyway.
1 parent 830e504 commit 8b094c3

File tree

8 files changed

+241
-282
lines changed

8 files changed

+241
-282
lines changed

src/Renci.SshNet/.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,11 @@ dotnet_diagnostic.CA5350.severity = none
180180
# CA5351: Do Not Use Broken Cryptographic Algorithms
181181
# https://learn.microsoft.com/en-ca/dotnet/fundamentals/code-analysis/quality-rules/ca5351
182182
dotnet_diagnostic.CA5351.severity = none
183+
184+
# MA0040: Forward the CancellationToken parameter to methods that take one
185+
# Partial/noisy duplicate of CA2016
186+
dotnet_diagnostic.MA0040.severity = none
187+
188+
# MA0042: Do not use blocking calls in an async method
189+
# duplicate of CA1849
190+
dotnet_diagnostic.MA0042.severity = none

src/Renci.SshNet/CommandAsyncResult.cs

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)