I would adapt `execCmdEx` for your purpose:
proc myExec(command, wd: string): tuple[output: string, exitCode: int] =
var p = startProcess(command, workingDir = wd, options =
{poStdErrToStdOut})
var outp = outputStream(p)
close inputStream(p)
result = ("", -1)
var line = newStringOfCap(120).TaintedString
while true:
if outp.readLine(line):
result[0].string.add(line.string)
result[0].string.add("\n")
else:
result[1] = peekExitCode(p)
if result[1] != -1: break
close(p)
Run
- Choosing the right `osproc` function sschwarzer
- Re: Choosing the right `osproc` function Araq
- Re: Choosing the right `osproc` function juancarlospaco
- Re: Choosing the right `osproc` function sschwarzer
- Re: Choosing the right `osproc` function sschwarzer
