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-signalchannel request, when in fact we should be sendingsignaland 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? ExitSignalproperty which has a value when the server sends one. (closes ExitSignalName #95 - seems like it existed once upon a time).IAsyncResult.WaitHandleonly when the command had completed successfully, or otherwise onceEndExecutehad 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. AddingExecuteAsyncshould only be a small step from here.ExitStatusby changing the return type frominttoint?, 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.