microsoft / microsoft/winget-cli
Close named process if running after successfull install
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 26.4k
- Forks
- 1.8k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 15
Description
Description of the new feature / enhancement
Some program installers run the program in question after successfull silent install, and there are no install parameters to prevent this.
Currently I know of these packages, which I handle manually in a PowerShell script I've made for myself.
$OverrideCloseProcessAfterInstall = [ordered]@{
'Cisco.CiscoWebexMeetings' = [string] 'ptoneclk'
'Famatech.AdvancedIPScanner' = [string] 'advanced_ip_scanner'
'Plex.Plex' = [string] 'plex'
'REALiX.HWiNFO' = [string] 'HWiNFO64'
'Resilio.ResilioSync' = [string] 'Resilio Sync'
}
Some developers show no interest in adding an option to disable run after silent install, such as HWiNFO author:
Some cases might be solved using portable edition once this get widespread adoption in Winget. But until then, or for programs that doesn't come in portable editions, it would be neat if Winget added a field to manifest that looked for a process by name until a maximum time after install is finished, maybe 10 seconds?
Proposed technical implementation details
I currently handle it like this in my PowerShell script.
Click to expand
Write-Information -MessageData ('### [Override] Stopping process "{0}" if found.' -f $OverrideCloseProcessAfterInstall.$($App.'Id'))
# Help variables
$ProcessClosed = [bool] $false
$Attempt = [byte] 0
$Attempts = [byte] 3
$Wait = [byte] 1
# Try to close process
do {
$Attempt++
Try {
$null = Get-Process -Name $OverrideCloseProcessAfterInstall.$($App.'Id') | Stop-Process -Force
$ProcessClosed = $true
}
Catch {
if ($Attempt -lt $Attempts) {
Write-Information -MessageData (
'Attempt {0} / {1} - Did not find process, trying again in {2} second{3}.' -f (
$Attempt.ToString(),
$Attempts.ToString(),
$Wait.ToString(),
$(if($Wait -ne 1){'s'})
)
)
$null = Start-Sleep -Seconds $Wait
}
else {
Write-Information -MessageData (
'Attempt {0} / {1} - Did not find process.' -f (
$Attempt.ToString(),
$Attempts.ToString()
)
)
}
}
}
until ($ProcessClosed -or $Attempt -ge $Attempts)
# Output results
if ($ProcessClosed) {
Write-Information -MessageData 'Successfully closed process.'
}
else {
Write-Information -MessageData 'Failed to find and close process.'
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no repository files or tests. Start by reviewing manifest handling and the installer flow, using the provided PowerShell script as behavioral context. Done means a manifest can identify a process to close after a successful install, with a bounded wait, and the process is closed when found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, powershell
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100