aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2018-02-12 20:00:26 +0000
committerJussi Pakkanen <jpakkane@gmail.com>2018-02-14 19:15:30 +0200
commitc027bb2c42e54b7e89de605c671abd165d379bbc (patch)
treecaf55483d7b78c85cd91a7c6ffb202c0e0e8e070
parente2b5ac29d6ce52faaa5daa214a07f3b76501ca98 (diff)
downloadmeson-c027bb2c42e54b7e89de605c671abd165d379bbc.zip
meson-c027bb2c42e54b7e89de605c671abd165d379bbc.tar.gz
meson-c027bb2c42e54b7e89de605c671abd165d379bbc.tar.bz2
Ensure any generation error appears in the logfile and thus in CI output
Since c2a5ac39, MesonApp.generate() closes the logfile before returning, which means that when invoked by mesonmain.run(), any MesonException is not logged there. MesonApp.generate() does not appear to have any other users I can find. This somewhat reduces the diagnostic value of the logfile. This also interacts badly with running project tests in CI, as _run_tests chooses to report the logfile contents, rather than stdout, for the configure step, and it thus doesn't report any configure error which caused a test failure.
-rw-r--r--mesonbuild/mesonmain.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index 619aa39..073e505 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -147,10 +147,7 @@ class MesonApp:
def generate(self):
env = environment.Environment(self.source_dir, self.build_dir, self.meson_script_launcher, self.options, self.original_cmd_line_args)
mlog.initialize(env.get_log_dir())
- try:
- self._generate(env)
- finally:
- mlog.shutdown()
+ self._generate(env)
def _generate(self, env):
mlog.debug('Build started at', datetime.datetime.now().isoformat())
@@ -374,6 +371,7 @@ def run(original_args, mainfile=None):
# Error message
mlog.log(e)
# Path to log file
+ mlog.shutdown()
logfile = os.path.join(app.build_dir, environment.Environment.log_dir, mlog.log_fname)
mlog.log("\nA full log can be found at", mlog.bold(logfile))
if os.environ.get('MESON_FORCE_BACKTRACE'):
@@ -383,4 +381,7 @@ def run(original_args, mainfile=None):
raise
traceback.print_exc()
return 1
+ finally:
+ mlog.shutdown()
+
return 0