Commit 58f865a2d3601e3767c4f67c3525761831d05085
Merge branch 'master' of gitlab.3dicc.com:gokr/blimp
Showing
1 changed file
with
13 additions
and
1 deletions
blimp.nim
... | ... | @@ -378,6 +378,18 @@ proc dumpConfig() = |
378 | 378 | echo "\tblimpVersion: " & $blimpVersion |
379 | 379 | echo "\n" |
380 | 380 | |
381 | +proc readAllX(file: File): string = | |
382 | + result = "" | |
383 | + var buffer = newString(4096) | |
384 | + while true: | |
385 | + var read = readBuffer(file, addr(buffer[0]), 4096) | |
386 | + if read == 4096: | |
387 | + result.add(buffer) | |
388 | + else: | |
389 | + buffer.setLen(read) | |
390 | + result.add(buffer) | |
391 | + break | |
392 | + | |
381 | 393 | let synopsis = """ |
382 | 394 | blimp [options] <command> <filenames...> |
383 | 395 | -h,--help Show this |
... | ... | @@ -495,7 +507,7 @@ area = args["area"].asString |
495 | 507 | if stdio: |
496 | 508 | verbose = false |
497 | 509 | try: |
498 | - stdinContent = readAll(stdin) | |
510 | + stdinContent = readAllX(stdin) | |
499 | 511 | close(stdin) |
500 | 512 | except: |
501 | 513 | quit("Failed reading stdin", 1) | ... | ... |