mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 17:34:43 +00:00
20 lines
435 B
Nim
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
|