Thanks for your answers and the code suggestion. I see what you're doing here, but I need the same temporary directory for all threads. :-)
Would the approach with `deepcopy` [as in the manual](https://nim-lang.org/docs/manual.html#threads-gc-safety) be safe? import os import posix_utils import strformat import threadpool let tempRootPath = mkdtemp("vppdiff") var tempRootPathPerThread {.threadvar.}: string proc xmiFilePath(fileNumber: int, cleaned: bool): string = let cleanedSuffix = "_cleaned" {.gcsafe.}: deepcopy(tempRootPathPerThread, tempRootPath) return tempRootPathPerThread / fmt"xmi{fileNumber}{cleanedSuffix}.xmi" var fv = spawn xmiFilePath(1, false) echo ^fv Run I'm looking forward to the new GC. :-)
