[object Object]

← back to Exo

fix: Create directory for PID file if it doesn't exist (#2075)

ce37bdceb6fcadf23220e80d949c23437b149b34 · 2026-05-09 15:10:22 +0300 · Kerollos Magdy

Ensure the directory for the PID file exists before creating it.

## Motivation

Fixes https://github.com/exo-explore/exo/issues/2074

## Changes

<!-- Describe what you changed in detail -->

## Why It Works

<!-- Explain why your approach solves the problem -->

## Test Plan

### Manual Testing
<!-- Hardware: (e.g., MacBook Pro M1 Max 32GB, Mac Mini M2 16GB,
connected via Thunderbolt 4) -->
<!-- What you did: -->
<!-- - -->

### Automated Testing
<!-- Describe changes to automated tests, or how existing tests cover
this change -->
<!-- - -->

Files touched

Diff

commit ce37bdceb6fcadf23220e80d949c23437b149b34
Author: Kerollos Magdy <kerolloz@yahoo.com>
Date:   Sat May 9 15:10:22 2026 +0300

    fix: Create directory for PID file if it doesn't exist (#2075)
    
    Ensure the directory for the PID file exists before creating it.
    
    ## Motivation
    
    Fixes https://github.com/exo-explore/exo/issues/2074
    
    ## Changes
    
    <!-- Describe what you changed in detail -->
    
    ## Why It Works
    
    <!-- Explain why your approach solves the problem -->
    
    ## Test Plan
    
    ### Manual Testing
    <!-- Hardware: (e.g., MacBook Pro M1 Max 32GB, Mac Mini M2 16GB,
    connected via Thunderbolt 4) -->
    <!-- What you did: -->
    <!-- - -->
    
    ### Automated Testing
    <!-- Describe changes to automated tests, or how existing tests cover
    this change -->
    <!-- - -->
---
 src/exo/utils/pidfile.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/exo/utils/pidfile.py b/src/exo/utils/pidfile.py
index 54b76e94..99d5bcd4 100644
--- a/src/exo/utils/pidfile.py
+++ b/src/exo/utils/pidfile.py
@@ -1,5 +1,6 @@
 from __future__ import annotations
 
+import os
 from typing import Final
 
 from exo_pyo3_bindings import Pidfile, PidfileError
@@ -15,6 +16,7 @@ class PidfileLockError(RuntimeError):
 
 def acquire_exo_pidfile() -> Pidfile:
     path = EXO_PID_FILE
+    os.makedirs(os.path.dirname(path), exist_ok=True)
     try:
         pidfile = Pidfile(path, _PIDFILE_MODE)
         pidfile.write()

← e5a1e5da Create PID file locking for EXO (#2072)  ·  back to Exo  ·  Andrei/mp capture stdio (#2056) 45df74ba →