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,
|
proc execNimscript(nimsFile, projectDir, actionName: string, options: Options,
|
||||||
live = true): tuple[output: string, exitCode: int] =
|
live = true): tuple[output: string, exitCode: int] =
|
||||||
let
|
let
|
||||||
shash = $projectDir.hash().abs()
|
nimsFileCopied = projectDir / nimsFile.splitFile().name & "_" & getProcessId() & ".nims"
|
||||||
nimsFileCopied = projectDir / nimsFile.splitFile().name & "_" & shash & ".nims"
|
|
||||||
outFile = getNimbleTempDir() & ".out"
|
outFile = getNimbleTempDir() & ".out"
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,15 @@ proc contains*(j: JsonNode, elem: tuple[key: string, val: JsonNode]): bool =
|
||||||
|
|
||||||
when not defined(windows):
|
when not defined(windows):
|
||||||
from posix import getpid
|
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 =
|
proc getNimbleTempDir*(): string =
|
||||||
## Returns a path to a temporary directory.
|
## 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
|
## 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
|
## first. In release builds the directory will be removed when nimble finishes
|
||||||
## its work.
|
## its work.
|
||||||
result = getTempDir() / "nimble_"
|
result = getTempDir() / "nimble_" & getProcessId()
|
||||||
when defined(windows):
|
|
||||||
proc GetCurrentProcessId(): int32 {.stdcall, dynlib: "kernel32",
|
|
||||||
importc: "GetCurrentProcessId".}
|
|
||||||
result.add($GetCurrentProcessId())
|
|
||||||
else:
|
|
||||||
result.add($getpid())
|
|
||||||
|
|
||||||
proc getNimbleUserTempDir*(): string =
|
proc getNimbleUserTempDir*(): string =
|
||||||
## Returns a path to a temporary directory.
|
## Returns a path to a temporary directory.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue