Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,23 @@ $process.Start()

Wait-Process -InputObject $process -TimeOut $command_timeout -ErrorVariable ev -ErrorAction SilentlyContinue

function Remove-Apps {
Write-Output "Removing installed apps after unsuccessful run"
$adb_path = dotnet xharness android state --adb
$packages = & $adb_path shell pm list packages net.dot
$split_packages = $packages.split(':')
For ($i = 1; $i -lt $split_packages.Length; $i += 2) {
echo $split_packages[$i] | %{&$adb_path uninstall $_}
}
}

if ($ev) {
$exit_code = -3
Stop-Process -InputObject $process -Force
$process.WaitForExit()
[Console]::Out.Flush()
Write-Output "User command timed out after $command_timeout seconds!"
Remove-Apps
} else {
$exit_code = $process.ExitCode
Write-Output "User command ended with $exit_code"
Expand All @@ -70,6 +81,9 @@ switch ($exit_code)
78 {
Write-Error "Encountered PACKAGE_INSTALLATION_FAILURE. This is typically not a failure of the work item. We will try it again on another Helix agent"
Write-Error "If this occurs repeatedly, please check for architectural mismatch, e.g. requesting installation on arm64_v8a-only queue for x86 or x86_64 APKs."

Remove-Apps

$retry = $true
Break
}
Expand Down