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,6 +378,18 @@ proc dumpConfig() = | ||
378 | echo "\tblimpVersion: " & $blimpVersion | 378 | echo "\tblimpVersion: " & $blimpVersion |
379 | echo "\n" | 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 | let synopsis = """ | 393 | let synopsis = """ |
382 | blimp [options] <command> <filenames...> | 394 | blimp [options] <command> <filenames...> |
383 | -h,--help Show this | 395 | -h,--help Show this |
@@ -495,7 +507,7 @@ area = args["area"].asString | @@ -495,7 +507,7 @@ area = args["area"].asString | ||
495 | if stdio: | 507 | if stdio: |
496 | verbose = false | 508 | verbose = false |
497 | try: | 509 | try: |
498 | - stdinContent = readAll(stdin) | 510 | + stdinContent = readAllX(stdin) |
499 | close(stdin) | 511 | close(stdin) |
500 | except: | 512 | except: |
501 | quit("Failed reading stdin", 1) | 513 | quit("Failed reading stdin", 1) |