Add closeImmediately param to Client.exec #57
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.
For using long running commands (say 'tail -f'), it is necessary to finish stdout stream whenever some expected results come and bind Process Resource usage to IO producing stream results. That way, resource is closed even though command is still running.
The problem lies in
channel.close(false)
which is run as part of closing the resource and takes 1 minute to complete (because command is still running and mina ssh client is just waiting for default 1min timeout). It should be possible to close channel immediately for such use case.Since there is no way to cancel command, this seems to be the only option. And it works :)