tuned signature;
authorwenzelm
Sat, 07 Sep 2013 17:23:05 +0200
changeset 53460 6015a663b889
parent 53459 33f773731f0c
child 53461 26c609ada983
tuned signature;
src/Pure/System/cygwin_init.scala
src/Pure/System/system_dialog.scala
src/Pure/Tools/build_dialog.scala
src/Pure/Tools/main.scala
--- a/src/Pure/System/cygwin_init.scala	Sat Sep 07 17:11:44 2013 +0200
+++ b/src/Pure/System/cygwin_init.scala	Sat Sep 07 17:23:05 2013 +0200
@@ -24,20 +24,7 @@
     {
       val cwd = new JFile(isabelle_home)
       val env = Map("CYGWIN" -> "nodosfilewarning")
-      val proc = Isabelle_System.raw_execute(cwd, env, true, args: _*)
-      proc.getOutputStream.close
-
-      val stdout = new BufferedReader(new InputStreamReader(proc.getInputStream, UTF8.charset))
-      try {
-        var line = stdout.readLine
-        while (line != null) {
-          system_dialog.echo(line)
-          line = stdout.readLine
-        }
-      }
-      finally { stdout.close }
-
-      proc.waitFor
+      system_dialog.execute(cwd, env, args: _*)
     }
 
     val cygwin_root = isabelle_home + "\\contrib\\cygwin"
--- a/src/Pure/System/system_dialog.scala	Sat Sep 07 17:11:44 2013 +0200
+++ b/src/Pure/System/system_dialog.scala	Sat Sep 07 17:23:05 2013 +0200
@@ -9,6 +9,7 @@
 
 import java.awt.{GraphicsEnvironment, Point, Font}
 import javax.swing.WindowConstants
+import java.io.{File => JFile, BufferedReader, InputStreamReader}
 
 import scala.swing.{ScrollPane, Button, CheckBox, FlowPanel,
   BorderPanel, Frame, TextArea, Component, Label}
@@ -63,6 +64,7 @@
   }
 
   def join(): Int = result.join
+  def join_exit(): Nothing = sys.exit(join)
 
 
   /* window */
@@ -185,5 +187,26 @@
 
   @volatile private var is_stopped = false
   override def stopped: Boolean = is_stopped
+
+
+  /* system operations */
+
+  def execute(cwd: JFile, env: Map[String, String], args: String*): Int =
+  {
+    val proc = Isabelle_System.raw_execute(cwd, env, true, args: _*)
+    proc.getOutputStream.close
+
+    val stdout = new BufferedReader(new InputStreamReader(proc.getInputStream, UTF8.charset))
+    try {
+      var line = stdout.readLine
+      while (line != null) {
+        echo(line)
+        line = stdout.readLine
+      }
+    }
+    finally { stdout.close }
+
+    proc.waitFor
+  }
 }
 
--- a/src/Pure/Tools/build_dialog.scala	Sat Sep 07 17:11:44 2013 +0200
+++ b/src/Pure/Tools/build_dialog.scala	Sat Sep 07 17:23:05 2013 +0200
@@ -36,7 +36,7 @@
 
             val system_dialog = new System_Dialog
             dialog(options, system_dialog, system_mode, dirs, session)
-            sys.exit(system_dialog.join)
+            system_dialog.join_exit
 
         case _ => error("Bad arguments:\n" + cat_lines(args))
       }
--- a/src/Pure/Tools/main.scala	Sat Sep 07 17:11:44 2013 +0200
+++ b/src/Pure/Tools/main.scala	Sat Sep 07 17:23:05 2013 +0200
@@ -22,7 +22,7 @@
     {
       GUI.dialog(null, "Isabelle", GUI.scrollable_text(Exn.message(exn)))
       system_dialog.return_code(2)
-      sys.exit(system_dialog.join)
+      system_dialog.join_exit
     }
 
     def build