do not buffer fifo streams here -- done in Isabelle_Process;
authorwenzelm
Fri, 13 Aug 2010 21:30:10 +0200
changeset 38371 5b615a4a3a68
parent 38370 8b15d0f98962
child 38372 e753f71b6b34
do not buffer fifo streams here -- done in Isabelle_Process; removed misleading comments -- blocking on open is not reliable on non-standard systems (Cygwin);
src/Pure/System/isabelle_system.scala
--- a/src/Pure/System/isabelle_system.scala	Fri Aug 13 18:21:19 2010 +0200
+++ b/src/Pure/System/isabelle_system.scala	Fri Aug 13 21:30:10 2010 +0200
@@ -8,8 +8,7 @@
 
 import java.util.regex.Pattern
 import java.util.Locale
-import java.io.{BufferedInputStream, FileInputStream, BufferedOutputStream, FileOutputStream,
-  OutputStream, File, IOException}
+import java.io.{InputStream, FileInputStream, OutputStream, FileOutputStream, File, IOException}
 import java.awt.{GraphicsEnvironment, Font}
 import java.awt.font.TextAttribute
 
@@ -287,39 +286,33 @@
     if (rc != 0) error(result)
   }
 
-  def fifo_input_stream(fifo: String): BufferedInputStream =
+  def fifo_input_stream(fifo: String): InputStream =
   {
-    // block until peer is ready
-    val stream =
-      if (Platform.is_windows) { // Cygwin fifo as Windows/Java input stream
-        val proc = execute(false, expand_path("$ISABELLE_HOME/lib/scripts/raw_dump"), fifo, "-")
-        proc.getOutputStream.close
-        proc.getErrorStream.close
-        proc.getInputStream
-      }
-      else new FileInputStream(fifo)
-    new BufferedInputStream(stream)
+    if (Platform.is_windows) { // Cygwin fifo as Windows/Java input stream
+      val proc = execute(false, expand_path("$ISABELLE_HOME/lib/scripts/raw_dump"), fifo, "-")
+      proc.getOutputStream.close
+      proc.getErrorStream.close
+      proc.getInputStream
+    }
+    else new FileInputStream(fifo)
   }
 
-  def fifo_output_stream(fifo: String): BufferedOutputStream =
+  def fifo_output_stream(fifo: String): OutputStream =
   {
-    // block until peer is ready
-    val stream =
-      if (Platform.is_windows) { // Cygwin fifo as Windows/Java output stream
-        val proc = execute(false, expand_path("$ISABELLE_HOME/lib/scripts/raw_dump"), "-", fifo)
-        proc.getInputStream.close
-        proc.getErrorStream.close
-        val out = proc.getOutputStream
-        new OutputStream {
-          override def close() { out.close(); proc.waitFor() }
-          override def flush() { out.flush() }
-          override def write(b: Array[Byte]) { out.write(b) }
-          override def write(b: Array[Byte], off: Int, len: Int) { out.write(b, off, len) }
-          override def write(b: Int) { out.write(b) }
-        }
+    if (Platform.is_windows) { // Cygwin fifo as Windows/Java output stream
+      val proc = execute(false, expand_path("$ISABELLE_HOME/lib/scripts/raw_dump"), "-", fifo)
+      proc.getInputStream.close
+      proc.getErrorStream.close
+      val out = proc.getOutputStream
+      new OutputStream {
+        override def close() { out.close(); proc.waitFor() }
+        override def flush() { out.flush() }
+        override def write(b: Array[Byte]) { out.write(b) }
+        override def write(b: Array[Byte], off: Int, len: Int) { out.write(b, off, len) }
+        override def write(b: Int) { out.write(b) }
       }
-      else new FileOutputStream(fifo)
-    new BufferedOutputStream(stream)
+    }
+    else new FileOutputStream(fifo)
   }