Write the current (or given) PID to the PID file.
(pid: int | None = None, path: Path | None = None)
| 288 | |
| 289 | |
| 290 | def write_pid(pid: int | None = None, path: Path | None = None) -> None: |
| 291 | """Write the current (or given) PID to the PID file.""" |
| 292 | pid_path = path or PID_PATH |
| 293 | pid_path.parent.mkdir(parents=True, exist_ok=True) |
| 294 | pid_path.write_text(str(pid or os.getpid()), encoding="utf-8") |
| 295 | |
| 296 | |
| 297 | def read_pid(path: Path | None = None) -> int | None: |
no outgoing calls