[m-rev.] diff: workaround bug #403

Julien Fischer jfischer at opturion.com
Thu Feb 18 14:32:35 AEDT 2016


Workaround bug #403.

compiler/mlds_to_java.m:
     Generate calls to flush stdout and stderr after runMain() has returned.
     Currently, they do not get flushed in some circumstances and we fail a
     number of test cases due to to this.   (XXX what about stdout_binary?)

Julien.

diff --git a/compiler/mlds_to_java.m b/compiler/mlds_to_java.m
index 93432a6..37da428 100644
--- a/compiler/mlds_to_java.m
+++ b/compiler/mlds_to_java.m
@@ -2,6 +2,7 @@
  % vim: ft=mercury ts=4 sw=4 et
  %-----------------------------------------------------------------------------%
  % Copyright (C) 2000-2011 The University of Melbourne.
+% Copyright (C) 2013-2016 The Mercury team.
  % This file may only be copied under the terms of the GNU General
  % Public License - see the file COPYING in the Mercury distribution.
  %-----------------------------------------------------------------------------%
@@ -2042,6 +2043,8 @@ write_main_driver(Indent, ClassName, !IO) :-
          "    }",
          "};",
          "jmercury.runtime.JavaInternal.runMain(run_main);",
+        "io.flush_output_3_p_0(io.stdout_stream_0_f_0());",
+        "io.flush_output_3_p_0(io.stderr_stream_0_f_0());",
          "java.lang.System.exit(jmercury.runtime.JavaInternal.exit_status);"
      ],
      list.foldl(write_indented_line(Indent + 1), Body, !IO),



More information about the reviews mailing list