summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2015-03-01 23:30:02 +0100
committerAndreas Rumpf <rumpf_a@web.de>2015-03-01 23:30:02 +0100
commit8b05bf3e8660ded6dec29e044aa532a60d291cec (patch)
tree635746d8ad2789af3ca0fea7ffe45e1222d75111
parent76e44dd034a9bf9db7a94f258239fa82137cdc6e (diff)
parent79ad73574c403df5ba6b0519a34adbc39dac30e8 (diff)
downloadNim-8b05bf3e8660ded6dec29e044aa532a60d291cec.tar.gz
Merge pull request #2238 from oderwat/fix-2228-readall-osx
Fix for readAll(stdin) problem on OS X and better anyway. I can confirm this works on Windows.
-rw-r--r--lib/system/sysio.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/system/sysio.nim b/lib/system/sysio.nim
index a05398a09..48adb895d 100644
--- a/lib/system/sysio.nim
+++ b/lib/system/sysio.nim
@@ -145,8 +145,8 @@ proc readAllFile(file: File): string =
 proc readAll(file: File): TaintedString = 
   # Separate handling needed because we need to buffer when we
   # don't know the overall length of the File.
-  var len = rawFileSize(file)
-  if len >= 0:
+  let len = if file != stdin: rawFileSize(file) else: -1
+  if len > 0:
     result = readAllFile(file, len).TaintedString
   else:
     result = readAllBuffer(file).TaintedString