Do not allow clearing Android logs if the emulator is not running (#21578)

### Description
Do not allow clearing Android logs if the emulator is not running



### Motivation and Context
Previously the Clearing Android logs step stuck until the pipeline
timeout. If one of the previous steps failed.
This commit is contained in:
Jian Chen 2024-08-22 10:18:01 -07:00 коммит произвёл GitHub
Родитель ff3e8b02c3
Коммит 6c1a3f85a6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 13 добавлений и 2 удалений

Просмотреть файл

@ -5,12 +5,23 @@ parameters:
type: stepList
steps:
- task: CmdLine@2
input:
script: |
if [ -f $(Build.BinariesDirectory)/emulator.pid ]; then
echo "Emulator is running."
echo "##vso[task.setvariable variable=isEmulatorRunning]True"
else
echo "Emulator is not running."
fi
name: Determine if emulator is running
- task: CmdLine@2
inputs:
script: |
python3 tools/python/run_adb.py logcat --clear
displayName: "Clear Android logs"
condition: succeededOrFailed()
condition: eq(variables['isEmulatorRunning'], 'True')
- ${{ parameters.steps }}
@ -19,4 +30,4 @@ steps:
script: |
python3 tools/python/run_adb.py logcat -d
displayName: "Dump Android logs"
condition: succeededOrFailed()
condition: eq(variables['isEmulatorRunning'], 'True')