ReadPID reads the daemon PID from .codemap/watch.pid
(root string)
| 53 | |
| 54 | // ReadPID reads the daemon PID from .codemap/watch.pid |
| 55 | func ReadPID(root string) (int, error) { |
| 56 | pidFile := filepath.Join(root, ".codemap", "watch.pid") |
| 57 | data, err := os.ReadFile(pidFile) |
| 58 | if err != nil { |
| 59 | return 0, err |
| 60 | } |
| 61 | var pid int |
| 62 | _, err = fmt.Sscanf(string(data), "%d", &pid) |
| 63 | return pid, err |
| 64 | } |
| 65 | |
| 66 | // RemovePID removes the PID file |
| 67 | func RemovePID(root string) { |
no outgoing calls