Files
Nim/tests/osproc/tstdin.nim
2017-02-24 09:48:38 +01:00

20 lines
435 B
Nim

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()
while true:
let line = p.outputStream.readLine()
if line != "":
echo line
else:
break