It would be something like this:
import std / [osproc, streams, asyncdispatch]
proc asyncProcess(cmd: string, args: seq[string]): Future[(int, string)]
{.async.} =
var p = startProcess(cmd, args=args)
while p.running: await sleepAsync 5
return (p.peekExitCode, readAll p.outputStream)
let a = asyncProcess("nim", @["-v"])
let b = asyncProcess("nim", @["-v"])
for (code, output) in waitFor all(a, b):
echo ">> ", code, "\n\n", output
Run
- What's the most idiomatic way to call ``execCmdEx`` in par... OldhamMade
- Re: What's the most idiomatic way to call ``execCmdEx... dawkot
- Re: What's the most idiomatic way to call ``execC... Stefan_Salewski
- Re: What's the most idiomatic way to call ``e... dawkot
- Re: What's the most idiomatic way to call... rayman22201
- Re: What's the most idiomatic way to... OldhamMade
- Re: What's the most idiomatic wa... OldhamMade
- Re: What's the most idiomati... zevv
- Re: What's the most idiomati... Stefan_Salewski
- Re: What's the most idiomati... dawkot
- Re: What's the most idiomati... rayman22201
- Re: What's the most idiomati... OldhamMade
- Re: What's the most idiomati... leorize
