Skip to content

Commit

Permalink
Show strace logs when the Fuchsia gen_package script gets an error fr…
Browse files Browse the repository at this point in the history
…om the packaging tool (flutter#13298)
  • Loading branch information
jason-simmons authored Oct 23, 2019
1 parent 227e44d commit 08930c3
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions tools/fuchsia/gen_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ def main():
else:
manifest_file = GenerateManifest(args.package_dir)

strace_out = os.path.abspath(os.path.join(os.path.dirname(pkg_dir), 'strace_out'))

pm_command_base = [
'strace',
'-f',
'-o',
strace_out,
args.pm_bin,
'-o',
os.path.abspath(os.path.join(pkg_dir, os.pardir)),
Expand All @@ -94,13 +100,19 @@ def main():
# Build and then archive the package
# Use check_output so if anything goes wrong we get the output.
try:
subprocess.check_output(pm_command_base + ['build'])
subprocess.check_output(pm_command_base + ['archive'])
for pm_command in ['build', 'archive']:
pm_command_args = pm_command_base + [pm_command]
sys.stderr.write("===== Running %s\n" % pm_command_args)
subprocess.check_output(pm_command_args)
except subprocess.CalledProcessError as e:
print('==================== Manifest contents =========================================')
with open(manifest_file, 'r') as manifest:
print(manifest.read())
sys.stdout.write(manifest.read())
print('==================== End manifest contents =====================================')
print('==================== Strace output =============================================')
with open(strace_out, 'r') as strace:
sys.stdout.write(strace.read())
print('==================== End strace output =========================================')
raise

return 0
Expand Down

0 comments on commit 08930c3

Please sign in to comment.