[armedbear-cvs] r13090 - in trunk/abcl/src/org/armedbear/lisp: . java/swing

Ville Voutilainen vvoutilainen at common-lisp.net
Fri Dec 10 15:58:12 UTC 2010


Author: vvoutilainen
Date: Fri Dec 10 10:58:09 2010
New Revision: 13090

Log:
Make --batch exit, use Lisp.exit() in places where applicable so
that the streams are flushed, hence allowing --eval output
to be flushed.


Modified:
   trunk/abcl/src/org/armedbear/lisp/Extensions.java
   trunk/abcl/src/org/armedbear/lisp/Interpreter.java
   trunk/abcl/src/org/armedbear/lisp/Primitives.java
   trunk/abcl/src/org/armedbear/lisp/java/swing/REPLConsole.java

Modified: trunk/abcl/src/org/armedbear/lisp/Extensions.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Extensions.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Extensions.java	Fri Dec 10 10:58:09 2010
@@ -227,6 +227,8 @@
     @Override
     public LispObject execute()
     {
+      ((Stream)Symbol.STANDARD_OUTPUT.getSymbolValue())._finishOutput();
+      ((Stream)Symbol.ERROR_OUTPUT.getSymbolValue())._finishOutput();
       exit(0);
       return LispThread.currentThread().nothing();
     }

Modified: trunk/abcl/src/org/armedbear/lisp/Interpreter.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Interpreter.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Interpreter.java	Fri Dec 10 10:58:09 2010
@@ -244,7 +244,7 @@
                         ++i;
                     } else {
                         System.err.println("No argument supplied to --eval");
-                        System.exit(1);
+                        exit(1);
                     }
                 } else if (arg.equals("--load") ||
                            arg.equals("--load-system-file")) {
@@ -252,7 +252,7 @@
                         ++i;
                     } else {
                         System.err.println("No argument supplied to --load");
-                        System.exit(1);
+                        exit(1);
                     }
                 } else {
                     arglist = new Cons(args[i], arglist);
@@ -292,13 +292,13 @@
                             sb.append(c.getCondition().writeToString());
                             sb.append(separator);
                             System.err.print(sb.toString());
-                            System.exit(2);
+                            exit(2);
                         }
                         ++i;
                     } else {
                         // Shouldn't happen.
                         System.err.println("No argument supplied to --eval");
-                        System.exit(1);
+                        exit(1);
                     }
                 } else if (arg.equals("--load") ||
                            arg.equals("--load-system-file")) {
@@ -313,11 +313,14 @@
                     } else {
                         // Shouldn't happen.
                         System.err.println("No argument supplied to --load");
-                        System.exit(1);
+                        exit(1);
                     }
                 }
             }
         }
+        if (_BATCH_MODE_.getSymbolValue() == T) {
+            exit(0);
+        }
     }
 
     public void run()
@@ -437,8 +440,11 @@
             catch (IOException e) {
                 Debug.trace(e);
             }
-        } else
+        } else {
+            ((Stream)Symbol.STANDARD_OUTPUT.getSymbolValue())._finishOutput();
+            ((Stream)Symbol.ERROR_OUTPUT.getSymbolValue())._finishOutput();
             System.exit(status);
+        }
     }
 
     public synchronized void dispose()

Modified: trunk/abcl/src/org/armedbear/lisp/Primitives.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Primitives.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Primitives.java	Fri Dec 10 10:58:09 2010
@@ -1596,7 +1596,7 @@
                     System.out.println(a.writeToString());
 
             //###FIXME: Bail out, but do it nicer...
-            System.exit(1);
+            exit(1);
             return NIL;
         }
     };

Modified: trunk/abcl/src/org/armedbear/lisp/java/swing/REPLConsole.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/java/swing/REPLConsole.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/java/swing/REPLConsole.java	Fri Dec 10 10:58:09 2010
@@ -302,7 +302,7 @@
       repl = Interpreter.createInstance().eval("#'top-level::top-level-loop");
     } catch (Throwable e) {
       e.printStackTrace();
-      System.exit(1);
+      exit(1);
     }
     final REPLConsole d = new REPLConsole(repl);
     final JTextComponent txt = new JTextArea(d);




More information about the armedbear-cvs mailing list