diff --git a/Terminal.Gui/ConsoleDrivers/EscSeqUtils/EscSeqUtils.cs b/Terminal.Gui/ConsoleDrivers/EscSeqUtils/EscSeqUtils.cs index 403a42545..6181e32ec 100644 --- a/Terminal.Gui/ConsoleDrivers/EscSeqUtils/EscSeqUtils.cs +++ b/Terminal.Gui/ConsoleDrivers/EscSeqUtils/EscSeqUtils.cs @@ -1,8 +1,4 @@ -using System.Diagnostics; -using System.Management; -using System.Runtime.InteropServices; - -namespace Terminal.Gui; +namespace Terminal.Gui; /// /// Provides a platform-independent API for managing ANSI escape sequences. @@ -1019,42 +1015,6 @@ public static class EscSeqUtils //} } - // TODO: Move this out of here and into ConsoleDriver or somewhere else. - /// - /// Get the terminal that holds the console driver. - /// - /// The process. - /// If supported the executable console process, null otherwise. - public static Process GetParentProcess (Process process) - { - if (!RuntimeInformation.IsOSPlatform (OSPlatform.Windows)) - { - return null; - } - - string query = "SELECT ParentProcessId FROM Win32_Process WHERE ProcessId = " + process.Id; - - using (var mos = new ManagementObjectSearcher (query)) - { - foreach (ManagementObject mo in mos.Get ()) - { - if (mo ["ParentProcessId"] is { }) - { - try - { - var id = Convert.ToInt32 (mo ["ParentProcessId"]); - - return Process.GetProcessById (id); - } - catch - { } - } - } - } - - return null; - } - /// /// Ensures a console key is mapped to one that works correctly with ANSI escape sequences. /// diff --git a/UnitTests/Input/EscSeqUtilsTests.cs b/UnitTests/Input/EscSeqUtilsTests.cs index 3d5e460dd..c8838b750 100644 --- a/UnitTests/Input/EscSeqUtilsTests.cs +++ b/UnitTests/Input/EscSeqUtilsTests.cs @@ -1142,19 +1142,6 @@ public class EscSeqUtilsTests Assert.Equal (new Point (1, 2), pos); } - [Fact] - public void GetParentProcess_Tests () - { - if (RuntimeInformation.IsOSPlatform (OSPlatform.Windows)) - { - Assert.NotNull (EscSeqUtils.GetParentProcess (Process.GetCurrentProcess ())); - } - else - { - Assert.Null (EscSeqUtils.GetParentProcess (Process.GetCurrentProcess ())); - } - } - [Fact] public void ResizeArray_ConsoleKeyInfo () {