compilers: Do not dump File content in log for compiler checks.

When doing a compiler check with a File object, there is no need to dump
the file into logs, we can just print the path. The file could
potentially be big.
This commit is contained in:
Xavier Claessens 2023-11-06 08:00:43 -05:00 committed by Xavier Claessens
parent f41a95ddf2
commit b1358ef61f
1 changed files with 3 additions and 7 deletions

View File

@ -789,14 +789,10 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta):
ofile.write(code)
# ccache would result in a cache miss
no_ccache = True
contents = code
code_debug = f'Code:\n{code}'
else:
srcname = code.fname
if not is_object(code.fname):
with open(code.fname, encoding='utf-8') as f:
contents = f.read()
else:
contents = '<binary>'
code_debug = f'Source file: {srcname}'
# Construct the compiler command-line
commands = self.compiler_args()
@ -817,7 +813,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta):
command_list = self.get_exelist(ccache=not no_ccache) + commands.to_native()
mlog.debug('Running compile:')
mlog.debug('Working directory: ', tmpdirname)
mlog.debug('Code:\n', contents)
mlog.debug(code_debug)
os_env = os.environ.copy()
os_env['LC_ALL'] = 'C'
if no_ccache: