equal
deleted
inserted
replaced
165 |
165 |
166 /* mkdirs */ |
166 /* mkdirs */ |
167 |
167 |
168 def mkdirs(path: Path): Unit = |
168 def mkdirs(path: Path): Unit = |
169 if (!path.is_dir) { |
169 if (!path.is_dir) { |
170 bash("perl -e \"use File::Path make_path; make_path(" + File.shell_path(path) + ");\"") |
170 bash_result("perl -e \"use File::Path make_path; make_path(" + File.shell_path(path) + ");\"") |
171 if (!path.is_dir) error("Failed to create directory: " + quote(File.platform_path(path))) |
171 if (!path.is_dir) error("Failed to create directory: " + quote(File.platform_path(path))) |
172 } |
172 } |
173 |
173 |
174 |
174 |
175 |
175 |
314 case _ => |
314 case _ => |
315 } |
315 } |
316 } |
316 } |
317 } |
317 } |
318 |
318 |
319 def bash_env(cwd: JFile, env: Map[String, String], script: String, |
319 def bash_result(script: String, cwd: JFile = null, env: Map[String, String] = null, |
320 progress_stdout: String => Unit = (_: String) => (), |
320 progress_stdout: String => Unit = (_: String) => (), |
321 progress_stderr: String => Unit = (_: String) => (), |
321 progress_stderr: String => Unit = (_: String) => (), |
322 progress_limit: Option[Long] = None, |
322 progress_limit: Option[Long] = None, |
323 strict: Boolean = true): Bash.Result = |
323 strict: Boolean = true): Bash.Result = |
324 { |
324 { |
340 |
340 |
341 Bash.Result(stdout.join, stderr.join, rc) |
341 Bash.Result(stdout.join, stderr.join, rc) |
342 } |
342 } |
343 } |
343 } |
344 |
344 |
345 def bash(script: String): Bash.Result = bash_env(null, null, script) |
345 def bash(script: String): Int = |
|
346 { |
|
347 val result = bash_result(script) |
|
348 Output.warning(Library.trim_line(result.err)) |
|
349 Output.writeln(Library.trim_line(result.out)) |
|
350 result.rc |
|
351 } |
346 |
352 |
347 |
353 |
348 /* system tools */ |
354 /* system tools */ |
349 |
355 |
350 def isabelle_tool(name: String, args: String*): (String, Int) = |
356 def isabelle_tool(name: String, args: String*): (String, Int) = |
363 case None => ("Unknown Isabelle tool: " + name, 2) |
369 case None => ("Unknown Isabelle tool: " + name, 2) |
364 } |
370 } |
365 } |
371 } |
366 |
372 |
367 def open(arg: String): Unit = |
373 def open(arg: String): Unit = |
368 bash("exec \"$ISABELLE_OPEN\" '" + arg + "' >/dev/null 2>/dev/null &") |
374 bash_result("exec \"$ISABELLE_OPEN\" '" + arg + "' >/dev/null 2>/dev/null &") |
369 |
375 |
370 def pdf_viewer(arg: Path): Unit = |
376 def pdf_viewer(arg: Path): Unit = |
371 bash("exec \"$PDF_VIEWER\" '" + File.standard_path(arg) + "' >/dev/null 2>/dev/null &") |
377 bash_result("exec \"$PDF_VIEWER\" '" + File.standard_path(arg) + "' >/dev/null 2>/dev/null &") |
372 |
378 |
373 def hg(cmd_line: String, cwd: Path = Path.current): Bash.Result = |
379 def hg(cmd_line: String, cwd: Path = Path.current): Bash.Result = |
374 bash("cd " + File.shell_path(cwd) + " && \"${HG:-hg}\" " + cmd_line) |
380 bash_result("cd " + File.shell_path(cwd) + " && \"${HG:-hg}\" " + cmd_line) |
375 |
381 |
376 |
382 |
377 /** Isabelle resources **/ |
383 /** Isabelle resources **/ |
378 |
384 |
379 /* components */ |
385 /* components */ |