diff --git a/src/DiffEngine/Process/ProcessCleanup.cs b/src/DiffEngine/Process/ProcessCleanup.cs index 9dc4f1a8..8e385548 100644 --- a/src/DiffEngine/Process/ProcessCleanup.cs +++ b/src/DiffEngine/Process/ProcessCleanup.cs @@ -46,9 +46,12 @@ public static void Refresh() public static void Kill(string command) { Guard.AgainstNullOrEmpty(command, nameof(command)); - var trimmedCommand = command.Replace("\"", ""); + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + command = TrimCommand(command); + } var matchingCommands = Commands - .Where(x => x.Command == trimmedCommand).ToList(); + .Where(x => x.Command == command).ToList(); Logging.Write($"Kill: {command}. Matching count: {matchingCommands.Count}"); if (matchingCommands.Count == 0) { @@ -63,9 +66,19 @@ public static void Kill(string command) } } + static string TrimCommand(string command) + { + return command.Replace("\"", ""); + } + public static bool IsRunning(string command) { Guard.AgainstNullOrEmpty(command, nameof(command)); + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + return commands.Any(x => x.Command == command); + } + command = TrimCommand(command); return commands.Any(x => x.Command == command); } diff --git a/src/DiffEngine/Process/WindowsProcess.cs b/src/DiffEngine/Process/WindowsProcess.cs index 827015bb..8f0b60cb 100644 --- a/src/DiffEngine/Process/WindowsProcess.cs +++ b/src/DiffEngine/Process/WindowsProcess.cs @@ -44,7 +44,7 @@ from Win32_Process var command = (string) process["CommandLine"]; var id = (int) Convert.ChangeType(process["ProcessId"], typeof(int)); process.Dispose(); - yield return new ProcessCommand(command.Replace("\"", ""), id); + yield return new ProcessCommand(command, id); } } } \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 249d4efd..a72afbe9 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,7 +2,7 @@ CS1591;CS0649 - 3.4.0 + 3.4.1 1.0.0 Json, Testing, Verify, Snapshot, Approvals Enables simple verification of complex models and documents.