/// <summary> /// Is the process group with still alive? /// This method assumes that isAlive is called on a pid that was alive not /// too long ago, and hence assumes no chance of pid-wrapping-around. /// </summary> /// <param name="pgrpId">process group id</param> /// <returns>true if any of process in group is alive.</returns> public static bool IsProcessGroupAlive(string pgrpId) { Shell.ShellCommandExecutor shexec = null; try { string[] args = new string[] { "kill", "-0", "-" + pgrpId }; shexec = new Shell.ShellCommandExecutor(args); shexec.Execute(); } catch (Shell.ExitCodeException) { return(false); } catch (IOException ioe) { Log.Warn("Error executing shell command " + shexec.ToString() + ioe); return(false); } return(shexec.GetExitCode() == 0 ? true : false); }