summary refs log tree commit diff stats
path: root/lib/system/sysio.nim
diff options
context:
space:
mode:
authorHans Raaf <hara@oderwat.de>2015-03-01 01:41:17 +0100
committerHans Raaf <hara@oderwat.de>2015-03-01 03:35:20 +0100
commit79ad73574c403df5ba6b0519a34adbc39dac30e8 (patch)
treed756e66c63ec37caec173680ace7b22200ba8a2a /lib/system/sysio.nim
parent2df10fc4a60e6c8f7e0b42205dba29988e0a5c06 (diff)
downloadNim-79ad73574c403df5ba6b0519a34adbc39dac30e8.tar.gz
Fix for readAll(stdin) problem on OS X and better anyway.
Diffstat (limited to 'lib/system/sysio.nim')
-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