Bug 1257155 - make mach run create console output by default on windows so dump/printf works in the parent process, r=froydnj

Differential Revision: https://phabricator.services.mozilla.com/D80095
This commit is contained in:
Gijs Kruitbosch 2020-06-17 22:39:37 +00:00
Родитель cde94b34ea
Коммит 67234feea3
1 изменённых файлов: 18 добавлений и 1 удалений

Просмотреть файл

@ -1096,6 +1096,23 @@ class RunProgram(MachCommandBase):
args = [unicode(a, encoding) if not isinstance(a, unicode) else a
for a in args]
some_debugging_option = debug or debugger or debugger_args
# By default, because Firefox is a GUI app, on Windows it will not
# 'create' a console to which stdout/stderr is printed. This means
# printf/dump debugging is invisible. We default to adding the
# -attach-console argument to fix this. We avoid this if we're launched
# under a debugger (which can do its own picking up of stdout/stderr).
# We also check for both the -console and -attach-console flags:
# -console causes Firefox to create a separate window;
# -attach-console just ends us up with output that gets relayed via mach.
# We shouldn't override the user using -console. For more info, see
# https://bugzilla.mozilla.org/show_bug.cgi?id=1257155
if sys.platform.startswith('win') and not some_debugging_option and \
'-console' not in args and '--console' not in args and \
'-attach-console' not in args and '--attach-console' not in args:
args.append('-attach-console')
extra_env = {
'MOZ_DEVELOPER_REPO_DIR': self.topsrcdir,
'MOZ_DEVELOPER_OBJ_DIR': self.topobjdir,
@ -1110,7 +1127,7 @@ class RunProgram(MachCommandBase):
if disable_e10s:
extra_env['MOZ_FORCE_DISABLE_E10S'] = '1'
if debug or debugger or debugger_args:
if some_debugging_option:
if 'INSIDE_EMACS' in os.environ:
self.log_manager.terminal_handler.setLevel(logging.WARNING)