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

Reply via email to