Hello GitHub
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using WEX.Logging.Interop;
|
||||
|
||||
namespace Calculator.UIAutomationLibrary
|
||||
{
|
||||
public class Utilities
|
||||
{
|
||||
public static void KillExistingCalculatorProcesses()
|
||||
{
|
||||
Log.Comment("Killing any existing Calculator processes");
|
||||
|
||||
foreach (var process in Process.GetProcessesByName(Path.GetFileNameWithoutExtension(Constants.ProcessName)))
|
||||
{
|
||||
try
|
||||
{
|
||||
process.Kill();
|
||||
Log.Comment($"Killed {process.ProcessName}, Id: {process.Id}");
|
||||
}
|
||||
catch (Exception) when (process.HasExited)
|
||||
{
|
||||
Log.Comment($"{process.ProcessName}, Id: {process.Id} already exited.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user