Fix numeric selection from lunch menu

Bug: 318871826
Test: 'lunch' with no arguments, then select a lunch target with a
number.

Change-Id: I8418ef0415437548d1429ec7a2c239d8c5b615d5
This commit is contained in:
Fabián Cañas
2024-01-05 16:57:39 -05:00
parent 415fdddd98
commit 03dd0283bc

View File

@@ -788,7 +788,7 @@ function lunch()
selection=aosp_arm-trunk_staging-eng
elif (echo -n $answer | grep -q -e "^[0-9][0-9]*$")
then
local choices=($(TARGET_BUILD_APPS= get_build_var COMMON_LUNCH_CHOICES))
local choices=($(TARGET_BUILD_APPS= TARGET_PRODUCT= TARGET_RELEASE= TARGET_BUILD_VARIANT= get_build_var COMMON_LUNCH_CHOICES 2>/dev/null))
if [ $answer -le ${#choices[@]} ]
then
# array in zsh starts from 1 instead of 0.