From: Reinhold Kainhofer <reinhold@kainhofer.com>
Date: Sat, 3 Sep 2011 23:50:16 +0000 (+0200)
Subject: Flush all ports after each file, flush stdout after displaying all options
X-Git-Tag: release/2.15.11-1~6
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d6bfed981f663c440475b56995c7f965af16589d;p=lilypond.git

Flush all ports after each file, flush stdout after displaying all options

So far, the output of the safe.ly regtest showed up randomly
in some later regtest, because stdout was buffered when redirected
to a file.
This patch flushes all ports after each processed file (only relevant
when multiple files are processed at once).

Unfortunately, it seems stdout is not an open Scheme port when
Scheme doesn't print anything to stdout. So, when displaying all
options, we have to flush stdout directly after printing all
options.
---

diff --git a/lily/program-option-scheme.cc b/lily/program-option-scheme.cc
index 1071d14d7d..ca22a2dff4 100644
--- a/lily/program-option-scheme.cc
+++ b/lily/program-option-scheme.cc
@@ -190,6 +190,7 @@ LY_DEFINE (ly_option_usage, "ly:option-usage", 0, 0, 0, (),
 {
   string help = get_help_string ();
   puts (help.c_str ());
+  fflush (stdout);
 
   return SCM_UNSPECIFIED;
 }
diff --git a/scm/lily.scm b/scm/lily.scm
index f7e53cb179..bbea5afab9 100644
--- a/scm/lily.scm
+++ b/scm/lily.scm
@@ -861,7 +861,8 @@ PIDs or the number of the process."
          (ly:set-option 'debug-gc-assert-parsed-dead #f)
          (if (ly:get-option 'debug-gc)
              (dump-gc-protects)
-             (ly:reset-all-fonts))))
+             (ly:reset-all-fonts))
+         (flush-all-ports)))
      files)
 
     ;; Ensure a notice re failed files is written to aggregate logfile.