blob: 7a39522a3317890733b775ec2efd2cb9029c40c5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
discard """
output: '''--------------------------------------
to stderr
to stderr
--------------------------------------
'''
"""
import osproc, os, streams
const filename = "ta_out".addFileExt(ExeExt)
doAssert fileExists(getCurrentDir() / "tests" / "osproc" / filename)
var p = startProcess(filename, getCurrentDir() / "tests" / "osproc",
options={})
try:
let stdoutStream = p.outputStream
let stderrStream = p.errorStream
var x = newStringOfCap(120)
var output = ""
while stderrStream.readLine(x.TaintedString):
output.add(x & "\n")
echo "--------------------------------------"
stdout.flushFile()
stderr.write output
stderr.flushFile()
echo "--------------------------------------"
stdout.flushFile()
finally:
p.close()
|