[
https://issues.apache.org/jira/browse/SSHD-576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14987313#comment-14987313
]
Goldstein Lyor commented on SSHD-576:
-------------------------------------
The test does not work - if I comment out the {code:java}&&
(shellOut.available() == 0) && (shellErr.available() == 0){code} that you
added, the test still succeeds, whereas it should have failed. It may be a
timing issue, but the test should *fail* without your patch. I think that what
you need to do is replace the output and/or error streams with ones that have a
special behavior. If you look at the code for _pumpStreams_ you will see that
the way that what you described occurs is if _available()_ returned a positive
number, but the _read_ call on the stream returned zero - in which case
_pumpStreams_ returns _false_. You need to create a situation where the 1st
time _pumpStreams_ is called for any stream it returns _false_ (i.e.,
_available()_ > 0, but _readLen = 0_, and then cause _shell.isAlive()_ to
return _false_.
> InvertedShellWrapper would not process all output from spawned processes
> ------------------------------------------------------------------------
>
> Key: SSHD-576
> URL: https://issues.apache.org/jira/browse/SSHD-576
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.14.0
> Reporter: Gustaf Lundh
> Attachments: 0001-Fix.patch, 0001-Fix.patch
>
>
> In some circumstances, where a spawned process outputs data just before it
> exits, the InvertedShellWrapper could return from
> InvertedShellWrapper.pumpStreams() before all data had been handled.
> To ensure all data is read, do not allow exit until the shell's/process'
> output streams are totally empty.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)