mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-24 00:05:25 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user