Filter the tools' own PID out of ps command result (#983)
authorSung Yoon Whang <suwhang@microsoft.com>
Sun, 5 Apr 2020 03:35:11 +0000 (20:35 -0700)
committerGitHub <noreply@github.com>
Sun, 5 Apr 2020 03:35:11 +0000 (20:35 -0700)
src/Tools/Common/Commands/ProcessStatus.cs

index 19ff7bec410703e751ed0cd1966f82cdc2422c08..1a8adf54ba7a0161a2829b27aaf2b9f09c8a3171 100644 (file)
@@ -34,8 +34,15 @@ namespace Microsoft.Internal.Common.Commands
                     .OrderBy(process => process.ProcessName)
                     .ThenBy(process => process.Id);
 
+                var currentPid = Process.GetCurrentProcess().Id;
+
                 foreach (var process in processes)
                 {
+                    if (process.Id == currentPid)
+                    {
+                        continue;
+                    }
+
                     try
                     {
                         sb.Append($"{process.Id, 10} {process.ProcessName, -10} {process.MainModule.FileName}\n");