[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/99615115
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/99615115
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/99615115

Branch: refs/heads/karaf-2.3.x
Commit: 996151154affa932a450957b37c5e25813aa479c
Parents: aa0c117
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 10:23:04 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/99615115/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 99f1b3b..527060e 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
@@ -464,6 +464,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