From 06571f5495fd48ee1b98873d92c3506ff2b9d6b0 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Mon, 30 Jul 2018 01:36:23 -0700 Subject: [PATCH] fixes #8323 : avoid polluting git status after `nim doc foo` (#8415) --- compiler/sem.nim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/sem.nim b/compiler/sem.nim index 0d484d2767..2c3fab5a58 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -608,16 +608,18 @@ proc myProcess(context: PPassContext, n: PNode): PNode = rod.storeNode(c.graph, c.module, result) proc testExamples(c: PContext) = + let outputDir = c.config.getNimcacheDir / "runnableExamples" + createDir(outputDir) let inp = toFullPath(c.config, c.module.info) - let outp = inp.changeFileExt"" & "_examples.nim" + let outp = outputDir / extractFilename(inp.changeFileExt"" & "_examples.nim") let nimcache = outp.changeFileExt"" & "_nimcache" - renderModule(c.runnableExamples, inp, outp) + renderModule(c.runnableExamples, inp, outp, conf = c.config) let backend = if isDefined(c.config, "js"): "js" elif isDefined(c.config, "cpp"): "cpp" elif isDefined(c.config, "objc"): "objc" else: "c" if os.execShellCmd(os.getAppFilename() & " " & backend & " --nimcache:" & nimcache & " -r " & outp) != 0: - quit "[Examples] failed" + quit "[Examples] failed: see " & outp else: removeFile(outp) removeFile(outp.changeFileExt(ExeExt))