Commit 2e64ee16 authored by Wez's avatar Wez Committed by Commit Bot

[fuchsia] Create system_logger resources before calling GetAmberRepo().

GetAmberRepo() may fail with an exception, in which case it is important
both that system logs are available for diagnosis, and that the finally
clause has access to the related variables that it expects.

Bug: 1067446
Change-Id: Ieed6f957d458b360c867d68ffd104fb8b830111f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2133977
Auto-Submit: Wez <wez@chromium.org>
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756303}
parent 145088bb
...@@ -161,18 +161,18 @@ def RunPackage(output_dir, target, package_paths, package_name, ...@@ -161,18 +161,18 @@ def RunPackage(output_dir, target, package_paths, package_name,
system_logger = ( system_logger = (
_AttachKernelLogReader(target) if args.system_logging else None) _AttachKernelLogReader(target) if args.system_logging else None)
try: try:
with target.GetAmberRepo(): if system_logger:
if system_logger: # Spin up a thread to asynchronously dump the system log to stdout
# Spin up a thread to asynchronously dump the system log to stdout # for easier diagnoses of early, pre-execution failures.
# for easier diagnoses of early, pre-execution failures. log_output_quit_event = multiprocessing.Event()
log_output_quit_event = multiprocessing.Event() log_output_thread = threading.Thread(
log_output_thread = threading.Thread( target=
target= lambda: _DrainStreamToStdout(system_logger.stdout, log_output_quit_event)
lambda: _DrainStreamToStdout(system_logger.stdout, log_output_quit_event) )
) log_output_thread.daemon = True
log_output_thread.daemon = True log_output_thread.start()
log_output_thread.start()
with target.GetAmberRepo():
target.InstallPackage(package_paths) target.InstallPackage(package_paths)
if system_logger: if system_logger:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment