Unique nims filename to enable parallelism
This commit is contained in:
parent
374f62614a
commit
be83dcdca9
2 changed files with 11 additions and 9 deletions
|
|
@ -24,8 +24,7 @@ const
|
|||
proc execNimscript(nimsFile, projectDir, actionName: string, options: Options,
|
||||
live = true): tuple[output: string, exitCode: int] =
|
||||
let
|
||||
shash = $projectDir.hash().abs()
|
||||
nimsFileCopied = projectDir / nimsFile.splitFile().name & "_" & shash & ".nims"
|
||||
nimsFileCopied = projectDir / nimsFile.splitFile().name & "_" & getProcessId() & ".nims"
|
||||
outFile = getNimbleTempDir() & ".out"
|
||||
|
||||
let
|
||||
|
|
|
|||
|
|
@ -148,6 +148,15 @@ proc contains*(j: JsonNode, elem: tuple[key: string, val: JsonNode]): bool =
|
|||
|
||||
when not defined(windows):
|
||||
from posix import getpid
|
||||
|
||||
proc getProcessId*(): string =
|
||||
when defined(windows):
|
||||
proc GetCurrentProcessId(): int32 {.stdcall, dynlib: "kernel32",
|
||||
importc: "GetCurrentProcessId".}
|
||||
result = $GetCurrentProcessId()
|
||||
else:
|
||||
result = $getpid()
|
||||
|
||||
proc getNimbleTempDir*(): string =
|
||||
## Returns a path to a temporary directory.
|
||||
##
|
||||
|
|
@ -155,13 +164,7 @@ proc getNimbleTempDir*(): string =
|
|||
## different for different runs of it. You have to make sure to create it
|
||||
## first. In release builds the directory will be removed when nimble finishes
|
||||
## its work.
|
||||
result = getTempDir() / "nimble_"
|
||||
when defined(windows):
|
||||
proc GetCurrentProcessId(): int32 {.stdcall, dynlib: "kernel32",
|
||||
importc: "GetCurrentProcessId".}
|
||||
result.add($GetCurrentProcessId())
|
||||
else:
|
||||
result.add($getpid())
|
||||
result = getTempDir() / "nimble_" & getProcessId()
|
||||
|
||||
proc getNimbleUserTempDir*(): string =
|
||||
## Returns a path to a temporary directory.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue