A couple of changes/fixes in SshCommand #1423
Merged
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.
CancelAsync
, we were sendingexit-signal
channel request, when in fact we should be sendingsignal
and the server will respond withexit-signal
. This explains why we did not see any response or channel close in Fix CancelAsync Cause Deadlock #1345 (@zeotuan fyi). Add a correspondingstring? ExitSignal
property which has a value when the server sends one. (closes ExitSignalName #95 - seems like it existed once upon a time).IAsyncResult.WaitHandle
only when the command had completed successfully, or otherwise onceEndExecute
had been called. But we should be setting it as soon as the command completes whether successfully, with an error or via cancellation. This refactors the logic by removing the extra wait handles and consolidating the completion logic onto theIAsyncResult.WaitHandle
. With this refactoring the logic intentionally looks (with some squinting) similar to aTask
. AddingExecuteAsync
should only be a small step from here.ExitStatus
by changing the return type fromint
toint?
, in order to distinguish between an exit status of 0 and when no exit status has been returned (because for example, an exit signal was returned instead). This is the second commit.