more robust console thread (cf. jedit plugin version);
authorwenzelm
Sun, 06 Jan 2008 19:18:01 +0100
changeset 25857 cdbef6152dcc
parent 25856 890c51553b33
child 25858 6704045112a8
more robust console thread (cf. jedit plugin version);
lib/classes/isabelle/IsabelleDemo.java
--- a/lib/classes/isabelle/IsabelleDemo.java	Sun Jan 06 18:09:34 2008 +0100
+++ b/lib/classes/isabelle/IsabelleDemo.java	Sun Jan 06 19:18:01 2008 +0100
@@ -33,12 +33,20 @@
             public void run()
             {
                 IsabelleProcess.Result result = null;
-                while (result == null || result.kind != IsabelleProcess.Result.Kind.EXIT) {
-                    try {
-                        result = results.take();
-                        System.err.println(result.toString());
-                    } catch (InterruptedException ex) { }
-                }
+                do {
+                  try {
+                    result = results.take();
+                  } catch (NullPointerException ex) {
+                    result = null;
+                  } catch (InterruptedException ex) {
+                    result = null;
+                  }
+                  if (result != null)
+                    System.err.println(result.toString());
+                  if (result.kind == IsabelleProcess.Result.Kind.EXIT) {
+                    result = null;
+                  }
+                } while (result != null);
                 System.err.println("Console thread terminated");
             }
         }).start();