summary refs log tree commit diff stats
path: root/koch.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <Andreas Rumpf>2016-11-18 15:28:14 +0100
committerAndreas Rumpf <Andreas Rumpf>2016-11-18 15:28:14 +0100
commit885f250f1bc39afda5854f2c37231b56f83b4d72 (patch)
treea6fb6072c2fbea5df37dc88c6a04fbb596b068ee /koch.nim
parent0e1304a3e2e221cc5d380bea9158da5943b00cae (diff)
downloadNim-885f250f1bc39afda5854f2c37231b56f83b4d72.tar.gz
'koch temp --option' passes options to the compiler compilation itself
Diffstat (limited to 'koch.nim')
-rw-r--r--koch.nim19
1 files changed, 17 insertions, 2 deletions
diff --git a/koch.nim b/koch.nim
index d8004b3e6..586565fc7 100644
--- a/koch.nim
+++ b/koch.nim
@@ -391,13 +391,28 @@ proc tests(args: string) =
     quit("tests failed", QuitFailure)
 
 proc temp(args: string) =
+  proc splitArgs(a: string): (string, string) =
+    # every --options before the command (indicated by starting
+    # with not a dash) is part of the bootArgs, the rest is part
+    # of the programArgs:
+    let args = os.parseCmdLine a
+    result = ("", "")
+    var i = 0
+    while i < args.len and args[i][0] == '-':
+      result[0].add " " & quoteShell(args[i])
+      inc i
+    while i < args.len:
+      result[1].add " " & quoteShell(args[i])
+      inc i
+
   var output = "compiler" / "nim".exe
   var finalDest = "bin" / "nim_temp".exe
   # 125 is the magic number to tell git bisect to skip the current
   # commit.
-  exec("nim c compiler" / "nim", 125)
+  let (bootArgs, programArgs) = splitArgs(args)
+  exec("nim c " & bootArgs & " compiler" / "nim", 125)
   copyExe(output, finalDest)
-  if args.len > 0: exec(finalDest & " " & args)
+  if programArgs.len > 0: exec(finalDest & " " & programArgs)
 
 proc copyDir(src, dest: string) =
   for kind, path in walkDir(src, relative=true):