diff --git a/blimp.nim b/blimp.nim index 9106a25..7b2a10a 100644 --- a/blimp.nim +++ b/blimp.nim @@ -127,6 +127,21 @@ proc expandDirs(templ: string): string = if gitRootDir.isNil: quit("Not in a git clone, can not expand %gitroot% in '" & templ & "'") result = result.replace("%gitroot%", gitRootDir) +# Copy of readAllBuffer from sysio.nim - we need to call it +# instead of readAll(stdin) which doesn't work on Windows. readAll +# first tries to find file size, and that trips up Windows. +proc readAllX(file: File): string = + result = "" + var buffer = newString(4096) + while true: + var read = readBuffer(file, addr(buffer[0]), 4096) + if read == 4096: + result.add(buffer) + else: + buffer.setLen(read) + result.add(buffer) + break + # Load a blimp.conf file proc parseConfFile(filename: string) = var f = newFileStream(filename, fmRead) @@ -495,7 +510,7 @@ area = args["area"].asString if stdio: verbose = false try: - stdinContent = readAll(stdin) + stdinContent = readAllX(stdin) close(stdin) except: quit("Failed reading stdin", 1)