public static void Kill(this IProcessManager processManager, Func <ProcessInfo, bool> predicate, ProcessSignal signal = ProcessSignal.SIGTERM, Action <Exception> onError = null) { processManager .GetProcessInfos(predicate) .ForEach(_ => { try { processManager.Kill(_.ProcessId, signal); } catch (Exception e) { onError?.Invoke(e); } }) ; }
public static ProcessInfo[] GetProcessInfos(this IProcessManager processManager, Func <ProcessInfo, bool> predicate) { return(processManager.GetProcessInfos(processManager.EnumerateProcessIds(), predicate)); }
public static ProcessInfo[] GetProcessInfos(this IProcessManager processManager) { var processIds = processManager.GetProcessIds(); return(processManager.GetProcessInfos(processIds)); }
public static ProcessInfo[] GetProcessInfos(this IProcessManager processManager, int[] processIds) { return(processManager.GetProcessInfos(processIds, (info) => true)); }
public static ProcessInfo GetProcessInfoById(this IProcessManager processManager, int pid) { return(processManager.GetProcessInfos(new[] { pid }).FirstOrDefault()); }