You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2012/10/08 11:06:03 UTC

[jira] [Commented] (KARAF-1226) Karaf Client cannot run a script

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

Guillaume Nodet commented on KARAF-1226:
----------------------------------------

I don't think the launcher idea is a good one.  We had that in the first stages, but there's currently no way to detect when things are started.  What could be valid for you will be invalid for someone else because of the use of other extenders, so until the OSGi spec comes with something standardized, I don't think we should do anything.

There are workarounds though.  You can always include the needed logic in your own scripts to wait for a given service to become available for example.

I think including a way to read commands from a file on the client is a really good idea however or to be able to detect that the input stream comes from a file and not real stdin.
                
> Karaf Client cannot run a script
> --------------------------------
>
>                 Key: KARAF-1226
>                 URL: https://issues.apache.org/jira/browse/KARAF-1226
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 2.2.5
>         Environment: Ubuntu 11.10 64-bit, OpenJDK 6
>            Reporter: Hendy Irawan
>            Assignee: Jean-Baptiste Onofré
>             Fix For: 2.3.1, 3.0.0
>
>         Attachments: KARAF-1226-client.patch, KARAF-1226-main.patch, KARAF-1226-shell.patch
>
>
> Example usage:
> {code}
> echo osgi:ls | bin/client
> {code}
> or:
> {code}
> bin/client < commands.karafsh
> {code}
> or redirecting stdout to file:
> {code}
> echo osgi:ls | bin/client > bundles.txt
> {code}
> Expected outcome:
> 1. Output of the command printed to stdout
> 2. Banners etc. (if any) printed to stderr
> 3. Shell prompt should not be output at all
> 4. The client exits immediately
> Actual behavior:
> 1. All output including banners and the shell prompt are printed to stdout (only)
> 2. The client then hangs but still using around 20% CPU usage. It's not possible to Ctrl+C, and need to kill the process.
> GNU tools (like bash) tend to detect the presence of an input stream, to differ between interactive mode and a batch mode.
> If this is not possible, can also add a switch e.g. "--batch" or "-b" for "Batch mode".
> Note that the karaf "bin/shell" script already handles this quite nicely... by not hanging after executing commands, and exits properly.
> BTW this should also be possible to do on karaf launcher itself (i.e. start Karaf, execute command(s), then immediately shutdown the runtime).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira