summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-09-18 12:20:58 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-09-18 15:27:54 +0200
commit23c323ea1df6a3db2c8c219b298cc18752d32829 (patch)
tree265cf3eb6a36e6be5c2a89fe73e0709d8007b075
parentd2fb6cc222141e49247d13cd51d92bd2d3c61a49 (diff)
downloadNim-23c323ea1df6a3db2c8c219b298cc18752d32829.tar.gz
docgen tests: patch 'nim' commands to use the currently running exe instead
-rw-r--r--compiler/docgen.nim10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/docgen.nim b/compiler/docgen.nim
index e7920ad06..83dd5de2a 100644
--- a/compiler/docgen.nim
+++ b/compiler/docgen.nim
@@ -976,10 +976,12 @@ proc commandRstAux(cache: IdentCache, conf: ConfigRef;
       # Nim's convention: every path is relative to the file it was written in:
       outp = splitFile(d.filename).dir.AbsoluteDir / RelativeFile(filename)
     writeFile(outp, content)
-    let cmd = cmd % quoteShell(outp)
-    rawMessage(conf, hintExecuting, cmd)
-    if execShellCmd(cmd) != status:
-      rawMessage(conf, errGenerated, "executing of external program failed: " & cmd)
+    let c = if cmd.startsWith("nim "): os.getAppFilename() & cmd.substr(3)
+            else: cmd
+    let c2 = c % quoteShell(outp)
+    rawMessage(conf, hintExecuting, c2)
+    if execShellCmd(c2) != status:
+      rawMessage(conf, errGenerated, "executing of external program failed: " & c2)
 
   d.isPureRst = true
   var rst = parseRst(readFile(filen.string), filen.string, 0, 1, d.hasToc,