summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2015-09-30 19:05:37 -0700
committerAman Gupta <aman@tmm1.net>2015-09-30 19:05:37 -0700
commitded5753292d837d2b4390caa64d3ebe8c8babc7c (patch)
treec27c85a8097f241109821f75bc2de8f7f5a2d537 /compiler
parent9f33baf51b24049f8ead63a8dd7a58db6ef0e490 (diff)
downloadNim-ded5753292d837d2b4390caa64d3ebe8c8babc7c.tar.gz
remove "rerun with --parallelBuild:1" message and show error inline
Diffstat (limited to 'compiler')
-rw-r--r--compiler/extccomp.nim25
1 files changed, 13 insertions, 12 deletions
diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim
index 29aa03c94..ac645f307 100644
--- a/compiler/extccomp.nim
+++ b/compiler/extccomp.nim
@@ -14,7 +14,7 @@
 
 import
   lists, ropes, os, strutils, osproc, platform, condsyms, options, msgs,
-  securehash
+  securehash, streams
 
 type
   TSystemCC* = enum
@@ -672,6 +672,12 @@ proc callCCompiler*(projectfile: string) =
   var prettyCmds: TStringSeq = @[]
   let prettyCb = proc (idx: int) =
     echo prettyCmds[idx]
+  let runCb = proc (idx: int, p: Process) =
+    let exitCode = p.peekExitCode
+    if exitCode != 0:
+      echo p.outputStream.readAll
+      rawMessage(errGenerated, "execution of an external compiler program '" &
+        cmds[idx] & "' failed with exit code: " & $exitCode)
   compileCFile(toCompile, script, cmds, prettyCmds, false)
   compileCFile(externalToCompile, script, cmds, prettyCmds, true)
   if optCompileOnly notin gGlobalOptions:
@@ -682,22 +688,17 @@ proc callCCompiler*(projectfile: string) =
         res = execWithEcho(cmds[i])
         if res != 0: rawMessage(errExecutionOfProgramFailed, cmds[i])
     elif optListCmd in gGlobalOptions or gVerbosity > 1:
-      res = execProcesses(cmds, {poEchoCmd, poUsePath, poParentStreams},
-                          gNumberOfProcessors)
+      res = execProcesses(cmds, {poEchoCmd, poStdErrToStdOut, poUsePath, poParentStreams},
+                          gNumberOfProcessors, afterRunEvent=runCb)
     elif gVerbosity == 1:
-      res = execProcesses(cmds, {poUsePath, poParentStreams},
-                          gNumberOfProcessors, prettyCb)
+      res = execProcesses(cmds, {poStdErrToStdOut, poUsePath, poParentStreams},
+                          gNumberOfProcessors, prettyCb, afterRunEvent=runCb)
     else:
-      res = execProcesses(cmds, {poUsePath, poParentStreams},
-                          gNumberOfProcessors)
+      res = execProcesses(cmds, {poStdErrToStdOut, poUsePath, poParentStreams},
+                          gNumberOfProcessors, afterRunEvent=runCb)
     if res != 0:
       if gNumberOfProcessors <= 1:
         rawMessage(errExecutionOfProgramFailed, cmds.join())
-      else:
-        rawMessage(errGenerated,
-                   " execution of an external compiler program failed: " &
-                   cmds.join() & "; " &
-                   "rerun with --parallelBuild:1 to see the error message")
   if optNoLinking notin gGlobalOptions:
     # call the linker:
     var it = PStrEntry(toLink.head)