You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Pedro Catalão (Jira)" <ji...@apache.org> on 2021/06/23 14:40:00 UTC

[jira] [Comment Edited] (KARAF-6895) ssh-commands not properly return

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

Pedro Catalão edited comment on KARAF-6895 at 6/23/21, 2:39 PM:
----------------------------------------------------------------

Hi,

 

This doesn't seem to be fixed, I had scripts that were ran via ssh like this:

 

ssh deployer@myserver 'bash -s' < myscript.sh

 

And inside "myscript.sh" there was a loop to monitor the install of certain bundles after a restart.

In this version the script doesn't run correctly anymore, I get the first result of the monitoring but then it stops.


was (Author: pedrocatalao):
Hi,

 

This doesn't seem to be fixed, I had scripts that were ran via ssh like this

```

ssh deployer@myserver 'bash -s' < myscript.sh

```

And inside "myscript.sh" there was a loop to monitor the install of certain bundles after a restart.

In this version the script doesn't run correctly anymore, I get the first result of the monitoring but then it stops.

> 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.
>            Assignee: Jean-Baptiste Onofré
>            Priority: Major
>             Fix For: 4.2.11, 4.3.1
>
>
> 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)