Capture queryview stderr and stdout in finalization scripts
Sometimes the output wasn't grep-able and this fixes it.
Ignore-AOSP-First: b/304316873#comment10
Test: Run the bazel query command multiple times before/after
and verify it works 100% of the time after.
Bug: 320589170
Change-Id: Ic60d3318287353aa71fdeb2c540899d588a2d273
diff --git a/tools/finalization/finalize-vintf-resources.sh b/tools/finalization/finalize-vintf-resources.sh
index c11ed32c..0a61b09 100755
--- a/tools/finalization/finalize-vintf-resources.sh
+++ b/tools/finalization/finalize-vintf-resources.sh
@@ -62,7 +62,7 @@
}" >> $bp_file
# get the previous kernel_configs properties and add them to the new module
- local kernel_configs=$($top/out/host/linux-x86/bin/bazel query --config=queryview //hardware/interfaces/compatibility_matrices:"$current_bp_module"--android_common --output=build | grep kernel_configs | sed 's/[^\[]*\[\(.*\)],/\1/' | sed 's/ //g' | sed 's/\"//g')
+ local kernel_configs=$($top/out/host/linux-x86/bin/bazel query --config=queryview //hardware/interfaces/compatibility_matrices:"$current_bp_module"--android_common --output=build 2>$1 | grep kernel_configs | sed 's/[^\[]*\[\(.*\)],/\1/' | sed 's/ //g' | sed 's/\"//g')
$top/out/host/linux-x86/bin/bpmodify -m $final_bp_module -property kernel_configs -a $kernel_configs -w $bp_file