From 6ccb44011349fc87c14067e689c775618a38e65f Mon Sep 17 00:00:00 2001 From: teknowledgist Date: Wed, 7 Feb 2024 13:05:30 -0500 Subject: [PATCH 1/2] (tixati) Fix for app running on update (#2182) This should fix [issue #2182](https://github.com/chocolatey-community/chocolatey-packages/issues/2182) by first closing any Tixati application processes running on install or uninstall. --- automatic/tixati/tools/chocolateyInstall.ps1 | 4 ++++ automatic/tixati/tools/chocolateyUninstall.ps1 | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/automatic/tixati/tools/chocolateyInstall.ps1 b/automatic/tixati/tools/chocolateyInstall.ps1 index 13d4982d3de..51e3ce58bdf 100644 --- a/automatic/tixati/tools/chocolateyInstall.ps1 +++ b/automatic/tixati/tools/chocolateyInstall.ps1 @@ -1,5 +1,9 @@ $ErrorActionPreference = 'Stop' +foreach ($process in (Get-Process "$env:ChocolateyPackageName*" -ErrorAction SilentlyContinue)) { + Stop-Process -Name $process.ProcessName -Force +} + $toolsDir = Split-Path -parent $MyInvocation.MyCommand.Definition $fileName = 'tixati-3.19-1.install.exe' $dlDir = "$Env:TEMP\chocolatey\$($Env:ChocolateyPackageName)\$($Env:ChocolateyPackageVersion)" diff --git a/automatic/tixati/tools/chocolateyUninstall.ps1 b/automatic/tixati/tools/chocolateyUninstall.ps1 index 77a22ed70c2..2d683603f5f 100644 --- a/automatic/tixati/tools/chocolateyUninstall.ps1 +++ b/automatic/tixati/tools/chocolateyUninstall.ps1 @@ -1,5 +1,9 @@ $ErrorActionPreference = 'Stop' +foreach ($process in (Get-Process "$env:ChocolateyPackageName*" -ErrorAction SilentlyContinue)) { + Stop-Process -Name $process.ProcessName -Force +} + $packageName = 'tixati' $installLocation = Get-AppInstallLocation $packageName $uninstaller = "$installLocation\uninstall.exe" From aac842535d49a1be634c69e75aeee713a7ba9da5 Mon Sep 17 00:00:00 2001 From: teknowledgist Date: Fri, 9 Feb 2024 13:06:45 -0500 Subject: [PATCH 2/2] (tixati) revised fix for (#2182) --- automatic/tixati/tools/chocolateyInstall.ps1 | 4 ++-- automatic/tixati/tools/chocolateyUninstall.ps1 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/automatic/tixati/tools/chocolateyInstall.ps1 b/automatic/tixati/tools/chocolateyInstall.ps1 index 51e3ce58bdf..842c0e41954 100644 --- a/automatic/tixati/tools/chocolateyInstall.ps1 +++ b/automatic/tixati/tools/chocolateyInstall.ps1 @@ -1,7 +1,7 @@ $ErrorActionPreference = 'Stop' -foreach ($process in (Get-Process "$env:ChocolateyPackageName*" -ErrorAction SilentlyContinue)) { - Stop-Process -Name $process.ProcessName -Force +if (Get-Process "Tixati*" -ErrorAction SilentlyContinue) { + Throw "Tixati is running! To prevent data loss, please fully quit Tixati before attempting to upgrade it." } $toolsDir = Split-Path -parent $MyInvocation.MyCommand.Definition diff --git a/automatic/tixati/tools/chocolateyUninstall.ps1 b/automatic/tixati/tools/chocolateyUninstall.ps1 index 2d683603f5f..acf0eb76514 100644 --- a/automatic/tixati/tools/chocolateyUninstall.ps1 +++ b/automatic/tixati/tools/chocolateyUninstall.ps1 @@ -1,7 +1,7 @@ $ErrorActionPreference = 'Stop' -foreach ($process in (Get-Process "$env:ChocolateyPackageName*" -ErrorAction SilentlyContinue)) { - Stop-Process -Name $process.ProcessName -Force +if (Get-Process "Tixati*" -ErrorAction SilentlyContinue) { + Throw "Tixati is running! To prevent data loss, please fully quit Tixati before attempting to uninstall it." } $packageName = 'tixati'