Ejemplo n.º 1
0
// TerminateApp will stop the Keybase (UI) app
func TerminateApp(context Context, log Log) error {
	appExecName := "Keybase"
	logf := logger.NewLoggerf(log)
	log.Info("Stopping Keybase app")
	appPIDs := process.TerminateAll(process.NewMatcher(appExecName, process.ExecutableEqual, logf), 5*time.Second, logf)
	if len(appPIDs) > 0 {
		log.Info("Terminated %s %v", appExecName, appPIDs)
	}
	return nil
}
Ejemplo n.º 2
0
func terminateExisting(programs []Program, log Log) {
	// Terminate any monitored processes
	ospid := os.Getpid()
	log.Infof("Terminating any existing programs we will be monitoring")
	for _, program := range programs {
		matcher := process.NewMatcher(program.Path, process.PathEqual, log)
		matcher.ExceptPID(ospid)
		log.Infof("Terminating %s", program.Path)
		process.TerminateAll(matcher, time.Second, log)
	}
}