--- a/src/Pure/System/isabelle_system.scala Sat Feb 13 21:10:13 2016 +0100
+++ b/src/Pure/System/isabelle_system.scala Sat Feb 13 21:17:08 2016 +0100
@@ -167,7 +167,7 @@
def mkdirs(path: Path): Unit =
if (!path.is_dir) {
- bash("perl -e \"use File::Path make_path; make_path(" + File.shell_path(path) + ");\"")
+ bash_result("perl -e \"use File::Path make_path; make_path(" + File.shell_path(path) + ");\"")
if (!path.is_dir) error("Failed to create directory: " + quote(File.platform_path(path)))
}
@@ -316,7 +316,7 @@
}
}
- def bash_env(cwd: JFile, env: Map[String, String], script: String,
+ def bash_result(script: String, cwd: JFile = null, env: Map[String, String] = null,
progress_stdout: String => Unit = (_: String) => (),
progress_stderr: String => Unit = (_: String) => (),
progress_limit: Option[Long] = None,
@@ -342,7 +342,13 @@
}
}
- def bash(script: String): Bash.Result = bash_env(null, null, script)
+ def bash(script: String): Int =
+ {
+ val result = bash_result(script)
+ Output.warning(Library.trim_line(result.err))
+ Output.writeln(Library.trim_line(result.out))
+ result.rc
+ }
/* system tools */
@@ -365,13 +371,13 @@
}
def open(arg: String): Unit =
- bash("exec \"$ISABELLE_OPEN\" '" + arg + "' >/dev/null 2>/dev/null &")
+ bash_result("exec \"$ISABELLE_OPEN\" '" + arg + "' >/dev/null 2>/dev/null &")
def pdf_viewer(arg: Path): Unit =
- bash("exec \"$PDF_VIEWER\" '" + File.standard_path(arg) + "' >/dev/null 2>/dev/null &")
+ bash_result("exec \"$PDF_VIEWER\" '" + File.standard_path(arg) + "' >/dev/null 2>/dev/null &")
def hg(cmd_line: String, cwd: Path = Path.current): Bash.Result =
- bash("cd " + File.shell_path(cwd) + " && \"${HG:-hg}\" " + cmd_line)
+ bash_result("cd " + File.shell_path(cwd) + " && \"${HG:-hg}\" " + cmd_line)
/** Isabelle resources **/
--- a/src/Pure/Tools/build.scala Sat Feb 13 21:10:13 2016 +0100
+++ b/src/Pure/Tools/build.scala Sat Feb 13 21:17:08 2016 +0100
@@ -602,7 +602,7 @@
private val result =
Future.thread("build") {
- Isabelle_System.bash_env(info.dir.file, env, script,
+ Isabelle_System.bash_result(script, info.dir.file, env,
progress_stdout = (line: String) =>
Library.try_unprefix("\floading_theory = ", line) match {
case Some(theory) => progress.theory(name, theory)
--- a/src/Tools/jEdit/src/active.scala Sat Feb 13 21:10:13 2016 +0100
+++ b/src/Tools/jEdit/src/active.scala Sat Feb 13 21:17:08 2016 +0100
@@ -33,9 +33,8 @@
Standard_Thread.fork("browser") {
val graph_file = Isabelle_System.tmp_file("graph")
File.write(graph_file, XML.content(body))
- Isabelle_System.bash_env(null,
- Map("GRAPH_FILE" -> File.standard_path(graph_file)),
- "\"$ISABELLE_TOOL\" browser -c \"$GRAPH_FILE\" &")
+ Isabelle_System.bash_result("\"$ISABELLE_TOOL\" browser -c \"$GRAPH_FILE\" &",
+ env = Map("GRAPH_FILE" -> File.standard_path(graph_file)))
}
case XML.Elem(Markup(Markup.GRAPHVIEW, _), body) =>