diff options
| author | Tao Bao <tbao@google.com> | 2019-04-02 21:23:44 -0700 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2019-04-02 21:23:44 -0700 |
| commit | ff872f2214c672e4e8fee4b8849bcfcb571bc20f (patch) | |
| tree | 5b27cc6323b75465bb5965378c6c4ec86d175d1a | |
| parent | fc7180cb5ad3580ecedd82693dfc660a64f23eda (diff) | |
| parent | 6d6ac4094f3fbef7512c64372fc203e5eb6914e6 (diff) | |
Abort the payload generation on extract_image errors. am: 9648990b5b
am: 6d6ac4094f
Change-Id: I4d2d3d1b30da0df05a9cd4c35e344022d7a9de74
| -rwxr-xr-x | scripts/brillo_update_payload | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/brillo_update_payload b/scripts/brillo_update_payload index c88709ce..f535185b 100755 --- a/scripts/brillo_update_payload +++ b/scripts/brillo_update_payload @@ -248,6 +248,9 @@ declare -A DST_PARTITIONS_MAP # List of partition names in order. declare -a PARTITIONS_ORDER +# A list of PIDs of the extract_image workers. +EXTRACT_IMAGE_PIDS=() + # A list of temporary files to remove during cleanup. CLEANUP_FILES=() @@ -530,6 +533,7 @@ Disabling deltas for this source version." # Extract partitions in background. extract_partition_brillo "${image}" "${partitions_array}" "${part}" \ "${part_file}" "${part_map_file}" & + EXTRACT_IMAGE_PIDS+=("$!") eval "${partitions_array}[\"${part}\"]=\"${part_file}\"" eval "${partitions_array}_MAP[\"${part}\"]=\"${part_map_file}\"" done @@ -559,8 +563,12 @@ extract_payload_images() { extract_image "${FLAGS_source_image}" SRC_PARTITIONS fi extract_image "${FLAGS_target_image}" DST_PARTITIONS PARTITIONS_ORDER - # Wait for all subprocesses. - wait + # Wait for all subprocesses to finish. Not using `wait` since it doesn't die + # on non-zero subprocess exit code. Not using `wait ${EXTRACT_IMAGE_PIDS[@]}` + # as it gives the status of the last process it has waited for. + for pid in ${EXTRACT_IMAGE_PIDS[@]}; do + wait ${pid} + done cleanup_partition_array SRC_PARTITIONS cleanup_partition_array SRC_PARTITIONS_MAP cleanup_partition_array DST_PARTITIONS |
