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.
This commit is contained in:
Andreas Rumpf
2015-03-01 23:30:02 +01:00

View File

@@ -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