MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / kill

Function kill

cmd/kill.go:19–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17}
18
19func kill() {
20 initDaemon()
21 if pid == -1 {
22 log.Info("Seems not have been started. Try use `openlist start` to start server.")
23 return
24 }
25 process, err := os.FindProcess(pid)
26 if err != nil {
27 log.Errorf("failed to find process by pid: %d, reason: %v", pid, process)
28 return
29 }
30 err = process.Kill()
31 if err != nil {
32 log.Errorf("failed to kill process %d: %v", pid, err)
33 } else {
34 log.Info("killed process: ", pid)
35 }
36 err = os.Remove(pidFile)
37 if err != nil {
38 log.Errorf("failed to remove pid file")
39 }
40 pid = -1
41}
42
43func init() {
44 RootCmd.AddCommand(KillCmd)

Callers 2

stopFunction · 0.85
kill.goFile · 0.85

Calls 2

initDaemonFunction · 0.85
RemoveMethod · 0.65

Tested by

no test coverage detected