Testament pre parallel (#9137)

* testament: move to root dir (it's not a test)

* osproc: fix process index passed to afterRunEvent for parallel runs

it was passing the index of the process, not index of all commands

* testament: complete file move

(cherry picked from commit 97738a4f28)
This commit is contained in:
Jacek Sieka
2018-10-12 09:27:47 -06:00
committed by narimiran
parent 44f5c7e90f
commit 7cf3944c38
18 changed files with 20 additions and 17 deletions

View File

@@ -236,6 +236,7 @@ proc execProcesses*(cmds: openArray[string],
if n > 1:
var i = 0
var q = newSeq[Process](n)
var idxs = newSeq[int](n) # map process index to cmds index
when defined(windows):
var w: WOHandleArray
@@ -248,6 +249,7 @@ proc execProcesses*(cmds: openArray[string],
if beforeRunEvent != nil:
beforeRunEvent(i)
q[i] = startProcess(cmds[i], options = options + {poEvalCommand})
idxs[i] = i
when defined(windows):
w[i] = q[i].fProcessHandle
inc(i)
@@ -304,12 +306,13 @@ proc execProcesses*(cmds: openArray[string],
if rexit >= 0:
result = max(result, abs(q[rexit].peekExitCode()))
if afterRunEvent != nil: afterRunEvent(rexit, q[rexit])
if afterRunEvent != nil: afterRunEvent(idxs[rexit], q[rexit])
close(q[rexit])
if i < len(cmds):
if beforeRunEvent != nil: beforeRunEvent(i)
q[rexit] = startProcess(cmds[i],
options = options + {poEvalCommand})
idxs[rexit] = i
when defined(windows):
w[rexit] = q[rexit].fProcessHandle
inc(i)