Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-1226

Karaf Client cannot run a script

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.2.5
    • 2.3.0, 3.0.0
    • karaf
    • None
    • Ubuntu 11.10 64-bit, OpenJDK 6

    Description

      Example usage:

      echo osgi:ls | bin/client
      

      or:

      bin/client < commands.karafsh
      

      or redirecting stdout to file:

      echo osgi:ls | bin/client > bundles.txt
      

      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).

      Attachments

        1. KARAF-1226-client.patch
          4 kB
          Hendy Irawan
        2. KARAF-1226-main.patch
          13 kB
          Hendy Irawan
        3. KARAF-1226-shell.patch
          8 kB
          Hendy Irawan

        Activity

          People

            gnodet Guillaume Nodet
            ceefour Hendy Irawan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: