[pypy-svn] r46500 - pypy/dist/pypy/translator/jvm/src/pypy

antocuni at codespeak.net antocuni at codespeak.net
Wed Sep 12 14:05:47 CEST 2007


Author: antocuni
Date: Wed Sep 12 14:05:46 2007
New Revision: 46500

Modified:
   pypy/dist/pypy/translator/jvm/src/pypy/ll_os.java
Log:
fix a bug when reading from stdin



Modified: pypy/dist/pypy/translator/jvm/src/pypy/ll_os.java
==============================================================================
--- pypy/dist/pypy/translator/jvm/src/pypy/ll_os.java	(original)
+++ pypy/dist/pypy/translator/jvm/src/pypy/ll_os.java	Wed Sep 12 14:05:46 2007
@@ -63,7 +63,9 @@
         try {
             byte[] buf = new byte[count];
             int n = stream.read(buf, 0, count);
-            return new String(buf);
+            if (n == -1)
+                return ""; // XXX: is it right?
+            return new String(buf, 0, n);
         }
         catch(IOException e) {
             ll_os.throwOSError(PyPy.EIO, e.getMessage());


More information about the pypy-svn mailing list