Tim B. created KARAF-6895:
-----------------------------

             Summary: ssh-commands not properly return
                 Key: KARAF-6895
                 URL: https://issues.apache.org/jira/browse/KARAF-6895
             Project: Karaf
          Issue Type: Bug
          Components: karaf
    Affects Versions: 4.3.0
            Reporter: Tim B.


Hi Karaf-Team,
after updating from Karaf 4.2.8 to Karaf 4.3.0 most of our automation scripts 
doesn't work anymore.

When we execute a command via ssh, the prompt doesn't return properly.
{code:java}
tb@jenkins:~$ ssh -p 8101 karaf@vm1 'info | grep "Karaf version"'
Password authentication
Password:
  Karaf version               4.3.0

{code}
The relevant part is after the result of the command, the bash didn't return. I 
have to press ctrl+c or something similar to get back to bash (or wait for a 
timeout).



On Karaf 4.2.0 the ssh immediatly returned after executing the command:
{code:java}
tb@jenkins:~$ ssh -p 8101 karaf@vm1 'info | grep "Karaf version"'
Password authentication
Password:
  Karaf version               4.2.8
tb@jenkins:~$
{code}

I have fixed this by editing the finally block at the end of
_org.apache.karaf.shell.ssh.ShellCommand#run_ from
{code:java}
} finally {
    StreamUtils.close(in, out, err);
    callback.onExit(exitStatus);
}
{code}
to 
{code:java}
} finally {
    callback.onExit(exitStatus);
    StreamUtils.close(in, out, err);
}
{code}
callback.onExit needs to write into the out-Stream. So it throws an Exception 
when it was closed before.

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to