added charset (from isabelle_process.scala);
added fifo_reader -- also works on Cygwin;
--- a/src/Pure/Tools/isabelle_system.scala Thu Aug 28 22:26:22 2008 +0200
+++ b/src/Pure/Tools/isabelle_system.scala Thu Aug 28 22:26:23 2008 +0200
@@ -8,15 +8,18 @@
package isabelle
import java.util.regex.{Pattern, Matcher}
-import java.io.File
+import java.io.{BufferedReader, InputStreamReader, FileInputStream, File}
object IsabelleSystem {
+ val charset = "UTF-8"
+
+
/* Isabelle environment settings */
def getenv(name: String) = {
- val value = System.getenv(name)
+ val value = System.getenv(if (name == "HOME") "HOME_JVM" else name)
if (value != null) value else ""
}
@@ -71,6 +74,14 @@
}
+ /* named pipes */
+
+ def fifo_reader(fifo: String) =
+ if (is_cygwin()) new BufferedReader(new InputStreamReader(Runtime.getRuntime.exec(
+ Array(platform_path("/bin/cat"), fifo)).getInputStream, charset))
+ else new BufferedReader(new InputStreamReader(new FileInputStream(fifo), charset))
+
+
/* processes */
private def posix_prefix() = if (is_cygwin()) List(platform_path("/bin/env")) else Nil