Add closeImmediately param to Client.exec#57
Conversation
|
Hmm, wouldn't it be better instead to adjust the behavior of |
|
It doesn't kill off the command, but it disconnects the session sooner. The command is killed off by remote side as soon as the session dies. Could it be that usePty = true is the default behavior in this case? |
|
The obvious difference I am seeing is that it doesn't hang for 1 minute after the stream completes when closeImmediately=true. Command is killed off in both cases though. |
|
@djspiewak, added a test case to demonstrate this use case. |
|
@djspiewak, any decision on this one? I am stuck using custom build of fs2-ssh just because of this. |
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 :)