summary refs log blame commit diff stats
path: root/tests/osproc/tstdin.nim
blob: b491c250006348da21bb77e63b7d9d3db5502b05 (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.exe" else: "ta"

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

var p = startProcess(filename, getCurrentDir() / "tests" / "osproc")
p.inputStream.write("5\n")
p.inputStream.flush()
while true:
  let line = p.outputStream.readLine()
  if line != "":
    echo line
  else:
    break