From 72aa64e91f6021a32e0324cc33d5e7a7478eb4d7 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 28 Sep 2022 17:13:49 +0100 Subject: [PATCH] [macOS] Clean up gen_snapshot copy invocation (flutter/engine#36461) create_macos_gen_snapshots.py uses `xcrun bitcode_strip` to copy gen_snapshot from its build directory to a suffixed gen_snapshot_arm64 or gen_snapshot_armv7, while stripping the bitcode segment, if any. This simplifies the python invocation to use subprocess.check_call, and also guarantees the process exits with failure in such a situation -- we weren't checking the return value of generate_gen_snapshot. This is cleanup for issues encountered while working on merging macOS/iOS gen_snapshot tooling. Issue: https://github.com/flutter/flutter/issues/103386 Issue: https://github.com/flutter/flutter/issues/101138 --- .../sky/tools/create_macos_gen_snapshots.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/engine/src/flutter/sky/tools/create_macos_gen_snapshots.py b/engine/src/flutter/sky/tools/create_macos_gen_snapshots.py index be93ced17d..4603bcd1c2 100755 --- a/engine/src/flutter/sky/tools/create_macos_gen_snapshots.py +++ b/engine/src/flutter/sky/tools/create_macos_gen_snapshots.py @@ -82,21 +82,9 @@ def generate_gen_snapshot(directory, destination): print('Cannot find gen_snapshot at %s' % gen_snapshot_dir) sys.exit(1) - command = [ + subprocess.check_call([ 'xcrun', 'bitcode_strip', '-r', gen_snapshot_dir, '-o', destination - ] - process = subprocess.Popen( - command, stderr=subprocess.STDOUT, stdout=subprocess.PIPE - ) - stdout, stderr = process.communicate() - exit_status = process.wait() - - if exit_status != 0: - print( - 'Error processing command with stdout[%s] and stderr[%s]' % - (stdout, stderr) - ) - return 1 + ]) if __name__ == '__main__':