--- 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
+ }
}