Skip to content

Commit

Permalink
Fix uninstall
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasNieto committed Oct 7, 2024
1 parent 1aa8ce5 commit fa7d591
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/code/ProgramsProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// terms of the MIT license.

using Microsoft.Win32;

using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -152,6 +156,7 @@ private void UninstallPackage(PackageInfo package, PackageRequest request)
}

using var process = GetProcess(uninstallString);
process.StartInfo.UseShellExecute = true;
process.Start();
process.WaitForExit();

Expand Down Expand Up @@ -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("\"", "");
Expand Down

0 comments on commit fa7d591

Please sign in to comment.