mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user