Skip to content

Commit

Permalink
Delay deleting the tool directory at VM-Uninstall-With-Uninstaller
Browse files Browse the repository at this point in the history
  • Loading branch information
d35ha committed Jun 12, 2024
1 parent 1f70a3e commit cd50854
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/common.vm/common.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>common.vm</id>
<version>0.0.0.20240607</version>
<version>0.0.0.20240612</version>
<description>Common libraries for VM-packages</description>
<authors>Mandiant</authors>
</metadata>
Expand Down
8 changes: 4 additions & 4 deletions packages/common.vm/tools/vm.common/vm.common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -791,10 +791,6 @@ function VM-Uninstall-With-Uninstaller {
# Remove tool shortcut
VM-Remove-Tool-Shortcut $toolName $category

# Remove tool files
$toolDir = Join-Path ${Env:RAW_TOOLS_DIR} $toolName
Remove-Item $toolDir -Recurse -Force -ea 0 | Out-Null

# Attempt to find and execute the uninstaller, may need to use wildcards
# See: https://docs.chocolatey.org/en-us/create/functions/get-uninstallregistrykey
[array]$key = Get-UninstallRegistryKey -SoftwareName $toolName
Expand All @@ -821,6 +817,10 @@ function VM-Uninstall-With-Uninstaller {
$key | ForEach-Object {VM-Write-Log "WARN" " - $($_.DisplayName)"}
VM-Write-Log "WARN" "Now allowing Chocolatey's auto uninstaller a chance to run."
}

# Remove tool files
$toolDir = Join-Path ${Env:RAW_TOOLS_DIR} $toolName
Remove-Item $toolDir -Recurse -Force -ea 0 | Out-Null
}

function VM-Write-Log-Exception {
Expand Down

0 comments on commit cd50854

Please sign in to comment.