summary refs log blame commit diff stats
path: root/tests/osproc/tstdin.nim
blob: 9b49ed78627d789a0195eede8c74db55ed38bb06 (plain) (tree)
1
2
3
4
5
6
7
8





                          
                                                                 
 


                                                                    
                          
                     




                                                  
discard """
  file: "tstdin.nim"
  output: "10"
"""
import osproc, os, streams

const filename = when defined(Windows): "ta_in.exe" else: "ta_in"

doAssert fileExists(getCurrentDir() / "tests" / "osproc" / filename)

var p = startProcess(filename, getCurrentDir() / "tests" / "osproc")
p.inputStream.write("5\n")
p.inputStream.flush()

var line = ""

while p.outputStream.readLine(line.TaintedString):
  echo line