| 131 | } |
| 132 | |
| 133 | func TestReadPIDInvalidContent(t *testing.T) { |
| 134 | root := t.TempDir() |
| 135 | codemapDir := filepath.Join(root, ".codemap") |
| 136 | if err := os.MkdirAll(codemapDir, 0o755); err != nil { |
| 137 | t.Fatal(err) |
| 138 | } |
| 139 | if err := os.WriteFile(filepath.Join(codemapDir, "watch.pid"), []byte("not-a-number"), 0o644); err != nil { |
| 140 | t.Fatal(err) |
| 141 | } |
| 142 | |
| 143 | if _, err := ReadPID(root); err == nil { |
| 144 | t.Fatal("expected parse error for invalid pid file content") |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | func TestIsOwnedDaemonInvalidPIDInputs(t *testing.T) { |
| 149 | tests := []struct { |