Bug 1261285 - Properly remove the config.log logging handler before running old-configure. r=ted
Because closing the handler is not enough (it eventually reopens
itself), the dumping of config.log overwrites the file, and confuses
the process of reading it to dump it in the first place, showing
incomplete logs. The intent from the start was that nothing would be
logged in the FileHandler, so on top of closing it, actively remove it.
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -406,16 +406,17 @@ def old_configure(prepare_configure, ext
# Our logging goes to config.log, the same file old.configure uses.
# We can't share the handle on the file, so close it. We assume nothing
# beyond this point is going to be interesting to log to config.log from
# our end, so we don't make the effort to recreate a logging.FileHandler.
logger = logging.getLogger('moz.configure')
for handler in logger.handlers:
if isinstance(handler, logging.FileHandler):
handler.close()
+ logger.removeHandler(handler)
log_size = os.path.getsize('config.log')
ret = subprocess.call(cmd)
if ret:
with log.queue_debug():
with encoded_open('config.log', 'r') as fh:
fh.seek(log_size)