[KARAF-2878] The thread reading the system input stream should exit 
automatically when the console bundle stops

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/e046011b
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/e046011b
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/e046011b

Branch: refs/heads/karaf-2.x
Commit: e046011bdb327ae6574192a28e6f48471fba7439
Parents: d571f14
Author: Guillaume Nodet <gno...@gmail.com>
Authored: Tue Jul 15 09:59:30 2014 +0200
Committer: Guillaume Nodet <gno...@gmail.com>
Committed: Tue Jul 15 09:59:30 2014 +0200

----------------------------------------------------------------------
 .../java/org/apache/karaf/shell/console/jline/Console.java     | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/e046011b/shell/console/src/main/java/org/apache/karaf/shell/console/jline/Console.java
----------------------------------------------------------------------
diff --git 
a/shell/console/src/main/java/org/apache/karaf/shell/console/jline/Console.java 
b/shell/console/src/main/java/org/apache/karaf/shell/console/jline/Console.java
index 70c46e9..90bd094 100644
--- 
a/shell/console/src/main/java/org/apache/karaf/shell/console/jline/Console.java
+++ 
b/shell/console/src/main/java/org/apache/karaf/shell/console/jline/Console.java
@@ -593,6 +593,12 @@ public class Console implements Runnable
                 {
                     try
                     {
+                        while (in.available() == 0) {
+                            if (!running) {
+                                return;
+                            }
+                            Thread.sleep(50);
+                        }
                         int c = in.read();
                         if (c == -1)
                         {

Reply via email to