summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/msgs.nim28
1 files changed, 20 insertions, 8 deletions
diff --git a/compiler/msgs.nim b/compiler/msgs.nim
index 28f85ac00..4dd134177 100644
--- a/compiler/msgs.nim
+++ b/compiler/msgs.nim
@@ -469,10 +469,10 @@ type
     fullPath: string           # This is a canonical full filesystem path
     projPath*: string          # This is relative to the project's root
     shortName*: string         # short name of the module
-    quotedName*: Rope         # cached quoted short name for codegen
+    quotedName*: Rope          # cached quoted short name for codegen
                                # purposes
 
-    lines*: seq[Rope]         # the source code of the module
+    lines*: seq[Rope]          # the source code of the module
                                #   used for better error messages and
                                #   embedding the original source in the
                                #   generated code
@@ -631,8 +631,11 @@ var
 
 proc suggestWriteln*(s: string) =
   if eStdOut in errorOutputs:
-    if isNil(writelnHook): writeLine(stdout, s)
-    else: writelnHook(s)
+    if isNil(writelnHook):
+      writeLine(stdout, s)
+      flushFile(stdout)
+    else:
+      writelnHook(s)
 
 proc msgQuit*(x: int8) = quit x
 proc msgQuit*(x: string) = quit x
@@ -726,7 +729,9 @@ var gTrackPos*: TLineInfo
 
 proc outWriteln*(s: string) =
   ## Writes to stdout. Always.
-  if eStdOut in errorOutputs: writeLine(stdout, s)
+  if eStdOut in errorOutputs:
+    writeLine(stdout, s)
+    flushFile(stdout)
 
 proc msgWriteln*(s: string) =
   ## Writes to stdout. If --stdout option is given, writes to stderr instead.
@@ -736,9 +741,13 @@ proc msgWriteln*(s: string) =
   if not isNil(writelnHook):
     writelnHook(s)
   elif optStdout in gGlobalOptions:
-    if eStdErr in errorOutputs: writeLine(stderr, s)
+    if eStdErr in errorOutputs:
+      writeLine(stderr, s)
+      flushFile(stderr)
   else:
-    if eStdOut in errorOutputs: writeLine(stdout, s)
+    if eStdOut in errorOutputs:
+      writeLine(stdout, s)
+      flushFile(stdout)
 
 macro callIgnoringStyle(theProc: typed, first: typed,
                         args: varargs[expr]): stmt =
@@ -773,13 +782,16 @@ template styledMsgWriteln*(args: varargs[expr]) =
   if not isNil(writelnHook):
     callIgnoringStyle(callWritelnHook, nil, args)
   elif optStdout in gGlobalOptions:
-    if eStdErr in errorOutputs: callIgnoringStyle(writeLine, stderr, args)
+    if eStdErr in errorOutputs:
+      callIgnoringStyle(writeLine, stderr, args)
+      flushFile(stderr)
   else:
     if eStdOut in errorOutputs:
       if optUseColors in gGlobalOptions:
         callStyledEcho(args)
       else:
         callIgnoringStyle(writeLine, stdout, args)
+      flushFile stdout
 
 proc coordToStr(coord: int): string =
   if coord == -1: result = "???"