public void TestLaunchProcessAndTerminate() { NSRunningApplication app = LaunchServices.OpenApplicationInternal(new ApplicationStartInfo("/Applications/Calculator.app")); try { Assert.IsNotNull(app); Assert.That(app.ProcessIdentifier, Is.GreaterThan(-1)); } finally { Assert.IsTrue(app.Terminate(), "Could not kill Calculator app"); } }
public static bool KillProcess(int pid) { NSRunningApplication runningApp = NSRunningApplication.GetRunningApplication(pid); if (runningApp == null) { return(false); } return(runningApp.Terminate()); }