Commit ce54e838922b19feeab648bbc967b58299163d9c
1 parent
8ae119dc
Fix broken merge, putting readAllX back.
Showing
1 changed file
with
16 additions
and
1 deletions
blimp.nim
| ... | ... | @@ -127,6 +127,21 @@ proc expandDirs(templ: string): string = |
| 127 | 127 | if gitRootDir.isNil: quit("Not in a git clone, can not expand %gitroot% in '" & templ & "'") |
| 128 | 128 | result = result.replace("%gitroot%", gitRootDir) |
| 129 | 129 | |
| 130 | +# Copy of readAllBuffer from sysio.nim - we need to call it | |
| 131 | +# instead of readAll(stdin) which doesn't work on Windows. readAll | |
| 132 | +# first tries to find file size, and that trips up Windows. | |
| 133 | +proc readAllX(file: File): string = | |
| 134 | + result = "" | |
| 135 | + var buffer = newString(4096) | |
| 136 | + while true: | |
| 137 | + var read = readBuffer(file, addr(buffer[0]), 4096) | |
| 138 | + if read == 4096: | |
| 139 | + result.add(buffer) | |
| 140 | + else: | |
| 141 | + buffer.setLen(read) | |
| 142 | + result.add(buffer) | |
| 143 | + break | |
| 144 | + | |
| 130 | 145 | # Load a blimp.conf file |
| 131 | 146 | proc parseConfFile(filename: string) = |
| 132 | 147 | var f = newFileStream(filename, fmRead) |
| ... | ... | @@ -495,7 +510,7 @@ area = args["area"].asString |
| 495 | 510 | if stdio: |
| 496 | 511 | verbose = false |
| 497 | 512 | try: |
| 498 | - stdinContent = readAll(stdin) | |
| 513 | + stdinContent = readAllX(stdin) | |
| 499 | 514 | close(stdin) |
| 500 | 515 | except: |
| 501 | 516 | quit("Failed reading stdin", 1) | ... | ... |