Commit 2dc05becc0e0d46bc50e4a470bb5c83cf258d66f

Authored by Göran Krampe
1 parent ed8fc143

Hacked our own readAllX that works with piping on windows.

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[&quot;area&quot;].asString @@ -495,7 +507,7 @@ area = args[&quot;area&quot;].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)