private static bool IsKoobooClosed() { var dotnetProcesses = Process.GetProcessesByName("dotnet"); foreach (var process in dotnetProcesses) { var processId = process.Id; var cmd = string.Format("ps -ef|grep {0}", processId); var str = CmdHelper.Excute(cmd, false); if (str.IndexOf(KoobooAppName, StringComparison.OrdinalIgnoreCase) == -1) { return(true); } } return(false); }
public static void CloseKooboo() { var dotnetProcesses = Process.GetProcessesByName("dotnet"); foreach (var process in dotnetProcesses) { var processId = process.Id; var cmd = string.Format("ps -ef|grep {0}", processId); Log(processId.ToString()); var str = CmdHelper.Excute(cmd, false); if (str.IndexOf(KoobooAppName, StringComparison.OrdinalIgnoreCase) > -1) { var closeCmd = "kill " + processId; CmdHelper.Excute(closeCmd, false); //break; //maybe open multi kooboo.app,so it continue to check kooboo.app process } } //wait koobo to close. WaitKoobooClosed(); }