From fa7d59101ed9a8d28bda56524a6cd1b4da95918f Mon Sep 17 00:00:00 2001 From: Thomas Nieto <38873752+ThomasNieto@users.noreply.github.com> Date: Mon, 7 Oct 2024 18:56:42 -0500 Subject: [PATCH] Fix uninstall --- src/code/ProgramsProvider.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/code/ProgramsProvider.cs b/src/code/ProgramsProvider.cs index 3ba05cb..9b93c9c 100644 --- a/src/code/ProgramsProvider.cs +++ b/src/code/ProgramsProvider.cs @@ -3,6 +3,7 @@ // terms of the MIT license. using Microsoft.Win32; + using System; using System.Collections.Generic; using System.Diagnostics; @@ -53,7 +54,10 @@ public void UninstallPackage(PackageRequest request) else { using var powershell = PowerShell.Create(RunspaceMode.CurrentRunspace); - powershell.AddCommand("Get-Package").AddParameter("Name", request.Name); + + powershell.AddCommand("Get-Package") + .AddParameter("Name", request.Name) + .AddParameter("Provider", ProviderInfo.FullName); if (request.Version is not null) { @@ -152,6 +156,7 @@ private void UninstallPackage(PackageInfo package, PackageRequest request) } using var process = GetProcess(uninstallString); + process.StartInfo.UseShellExecute = true; process.Start(); process.WaitForExit(); @@ -188,7 +193,7 @@ private Process GetProcess(string text) } var process = new Process(); - + if (found && quoted) { process.StartInfo.FileName = text.Substring(0, position + 1).Replace("\"", "");