Files
PowerToys/src/modules/cmdpal/ext/ProcessMonitorExtension/TerminateProcess.cs
Mike Griese 2b5181b4c9 Rename the [Ee]xts dir to ext (#38852)
**WARNING:** This PR will probably blow up all in-flight PRs

at some point in the early days of CmdPal, two of us created seperate
`Exts` and `exts` dirs. Depending on what the casing was on the branch
that you checked one of those out from, it'd get stuck like that on your
PC forever.

Windows didn't care, so we never noticed.

But GitHub does care, and now browsing the source on GitHub is basically
impossible.

Closes #38081
2025-04-15 06:07:22 -05:00

31 lines
879 B
C#

// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
using Microsoft.CommandPalette.Extensions.Toolkit;
namespace ProcessMonitorExtension;
internal sealed partial class TerminateProcess : InvokableCommand
{
private readonly ProcessItem _process;
private readonly ProcessListPage _owner;
public TerminateProcess(ProcessItem process, ProcessListPage owner)
{
_process = process;
_owner = owner;
Icon = new IconInfo("\ue74d");
Name = "End task";
}
public override CommandResult Invoke()
{
var process = Process.GetProcessById(_process.ProcessId);
process.Kill();
_owner.UpdateItems();
return CommandResult.KeepOpen();
}
}