Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix uninstall #37

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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