Fix for readAll(stdin) problem on OS X and better anyway.

This commit is contained in:
Hans Raaf
2015-03-01 01:41:17 +01:00
parent 2df10fc4a6
commit 79ad73574c

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