[ 
https://issues.apache.org/jira/browse/SSHD-580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14992970#comment-14992970
 ] 

ASF GitHub Bot commented on SSHD-580:
-------------------------------------

GitHub user volth opened a pull request:

    https://github.com/apache/mina-sshd/pull/14

    SSHD-580 candidate fix

    Proposed fix for https://issues.apache.org/jira/browse/SSHD-580

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/volth/mina-sshd SSHD-580

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/mina-sshd/pull/14.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #14
    
----
commit e82c486d24e0a06824d8fa2f4b3d9dfe6df5ff7f
Author: volth <[email protected]>
Date:   2015-11-06T02:36:48Z

    SSHD-580 candidate fix

----


> getInvertedIn.close() does not close stdin of remote program
> ------------------------------------------------------------
>
>                 Key: SSHD-580
>                 URL: https://issues.apache.org/jira/browse/SSHD-580
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 1.1.0
>            Reporter: Volth
>
> {code:java}
> val channel = session.createExecChannel("cat /dev/stdin")
> channel.setOut(new sshd.common.util.io.NoCloseOutputStream(System.out))
> channel.setErr(new sshd.common.util.io.NoCloseOutputStream(System.err))
> channel.open().verify()
> val out = channel.getInvertedIn
> out.write("lala\nla".getBytes)
> out.close()
> channel.waitFor(sshd.client.channel.ClientChannel.ClientChannelEvent.CLOSED 
> :: Nil, 0)
> {code}
> I expect that out.close() would close stdin of remote program and such 
> process as "cat /dev/stdin" would terminate after reading stdin to the end.
> It works well when the pumping thread is in action:
> {code:java}
> val channel = session.createExecChannel("cat /dev/stdin")
> channel.setOut(new sshd.common.util.io.NoCloseOutputStream(System.out))
> channel.setErr(new sshd.common.util.io.NoCloseOutputStream(System.err))
> channel.setIn(new ByteArrayInputStream("lala\nla".getBytes))
> channel.open().verify()
> channel.waitFor(sshd.client.channel.ClientChannel.ClientChannelEvent.CLOSED 
> :: Nil, 0)
> {code}
> The pumping thread sends SSH_MSG_CHANNEL_EOF message at the end of the data.
> invertedIn.close() does not.
> Tested agains git "master" and wide range of remote ssh-servers



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to