瀏覽代碼

[java] Fixed EOF catching on the output of sys.io.Process

Jonas Malaco Filho 11 年之前
父節點
當前提交
a105259182
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5 5
      std/java/_std/sys/io/Process.hx

+ 5 - 5
std/java/_std/sys/io/Process.hx

@@ -104,17 +104,17 @@ private class ProcessInput extends java.io.NativeInput
 	{
 	{
 		if (chained != null)
 		if (chained != null)
 			return chained.readByte();
 			return chained.readByte();
+		var ret = 0;
 		try
 		try
 		{
 		{
-			return stream.read();
+			ret = stream.read();
 		}
 		}
-		catch (e:EOFException) {
-			throw new Eof();
-		}
-
 		catch (e:IOException) {
 		catch (e:IOException) {
 			throw haxe.io.Error.Custom(e);
 			throw haxe.io.Error.Custom(e);
 		}
 		}
+		if ( ret == -1 )
+			throw new Eof();
+		return ret;
 	}
 	}
 
 
 	override public function readBytes(s:Bytes, pos:Int, len:Int):Int
 	override public function readBytes(s:Bytes, pos:Int, len:Int):Int