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

Function initDaemon

cmd/common.go:24–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22var pidFile string
23
24func initDaemon() {
25 ex, err := os.Executable()
26 if err != nil {
27 log.Fatal(err)
28 }
29 exPath := filepath.Dir(ex)
30 _ = os.MkdirAll(filepath.Join(exPath, "daemon"), 0700)
31 pidFile = filepath.Join(exPath, "daemon/pid")
32 if utils.Exists(pidFile) {
33 bytes, err := os.ReadFile(pidFile)
34 if err != nil {
35 log.Fatal("failed to read pid file", err)
36 }
37 id, err := strconv.Atoi(string(bytes))
38 if err != nil {
39 log.Fatal("failed to parse pid data", err)
40 }
41 pid = id
42 }
43}

Callers 3

startFunction · 0.85
stopFunction · 0.85
killFunction · 0.85

Calls 2

ExistsFunction · 0.92
MkdirAllMethod · 0.45

Tested by

no test coverage detected