summary refs log tree commit diff stats
path: root/tests/osproc/tstdin.nim
blob: 2ea93999240e4a28e9d1982fe8eda021ae5c0acd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
discard """
  file: "tstdin.nim"
  output: "10"
"""
import osproc, os, streams

doAssert fileExists(getCurrentDir() / "tests" / "osproc" / "ta.exe")

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