felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r927756 - /felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/Console.java
Date Fri, 26 Mar 2010 10:05:52 GMT
Author: gnodet
Date: Fri Mar 26 10:05:52 2010
New Revision: 927756

URL: http://svn.apache.org/viewvc?rev=927756&view=rev
Log:
FELIX-2237: ^C should interrupt the thread

Modified:
    felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/Console.java

Modified: felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/Console.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/Console.java?rev=927756&r1=927755&r2=927756&view=diff
==============================================================================
--- felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/Console.java
(original)
+++ felix/trunk/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/Console.java
Fri Mar 26 10:05:52 2010
@@ -73,6 +73,7 @@ public class Console implements Runnable
     private InputStream in;
     private PrintStream out;
     private PrintStream err;
+    private Thread thread;
 
     public Console(CommandProcessor processor,
                    InputStream in,
@@ -134,6 +135,7 @@ public class Console implements Runnable
 
     public void run()
     {
+        thread = Thread.currentThread();
         running = true;
         pipe.start();
         welcome();
@@ -165,6 +167,7 @@ public class Console implements Runnable
         }
         while (running) {
             try {
+                checkInterrupt();
                 String line = reader.readLine(getPrompt());
                 if (line == null)
                 {
@@ -280,7 +283,7 @@ public class Console implements Runnable
     }
 
     private void checkInterrupt() throws IOException {
-        if (interrupt) {
+        if (Thread.interrupted() || interrupt) {
             interrupt = false;
             throw new InterruptedIOException("Keyboard interruption");
         }
@@ -288,6 +291,7 @@ public class Console implements Runnable
 
     private void interrupt() {
         interrupt = true;
+        thread.interrupt();
     }
 
     private class ConsoleInputStream extends InputStream



Mime
View raw message