summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/cmdlinehelper.nim7
-rw-r--r--compiler/options.nim5
2 files changed, 5 insertions, 7 deletions
diff --git a/compiler/cmdlinehelper.nim b/compiler/cmdlinehelper.nim
index 13090ce9c..fa1eb3816 100644
--- a/compiler/cmdlinehelper.nim
+++ b/compiler/cmdlinehelper.nim
@@ -64,12 +64,9 @@ proc loadConfigsAndRunMainCommand*(self: NimProg, cache: IdentCache; conf: Confi
       var tempConf = newConfigRef()
       setDefaultLibpath(tempConf)
       initDefines(tempConf.symbols)
-      tempConf.command = conf.command
-      tempConf.commandArgs = conf.commandArgs
-      tempConf.searchPaths = conf.searchPaths
-      tempConf.lazyPaths = conf.lazyPaths
+      mergeConfigs(tempConf, conf, mergeSymbols = false)
       runNimScript(cache, p, freshDefines = false, tempConf)
-      mergeConfigs(conf, tempConf)
+      mergeConfigs(conf, tempConf, mergeSymbols = true)
 
   # Caution: make sure this stays in sync with `loadConfigs`
   if optSkipSystemConfigFile notin conf.globalOptions:
diff --git a/compiler/options.nim b/compiler/options.nim
index 7e853d646..65f2b907a 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -253,7 +253,7 @@ template depConfigFields*(fn) {.dirty.} =
   fn(globalOptions)
   fn(selectedGC)
 
-proc mergeConfigs*(dest, src: ConfigRef) =
+proc mergeConfigs*(dest, src: ConfigRef; mergeSymbols: bool) =
   template merge[T: enum](a, b: T) =
     a = b
   template merge[T](a, b: set[T]) =
@@ -301,7 +301,8 @@ proc mergeConfigs*(dest, src: ConfigRef) =
   m warnCounter
   m errorMax
   m configVars
-  m symbols
+  if mergeSymbols:
+    m symbols
   m searchPaths
   m lazyPaths
   m outFile