@@ -54,6 +54,7 @@ def _get_repo_root(start_path: str) -> str:
5454 else :
5555 repo_probe_cwd = os .path .abspath (start_path ) or "."
5656
57+ result : subprocess .CompletedProcess [str ] | None = None
5758 try :
5859 result = subprocess .run (
5960 ["git" , "rev-parse" , "--show-toplevel" ],
@@ -64,8 +65,9 @@ def _get_repo_root(start_path: str) -> str:
6465 except OSError as exc :
6566 _die (f"Failed to detect git repo root: { exc } " )
6667
67- if result .returncode != 0 :
68- _die (f"Failed to detect git repo root: { result .stderr .strip ()} " )
68+ if result is None or result .returncode != 0 :
69+ stderr = result .stderr .strip () if result is not None else "unknown error"
70+ _die (f"Failed to detect git repo root: { stderr } " )
6971 return result .stdout .strip ()
7072
7173
@@ -129,6 +131,7 @@ def preflight() -> None:
129131 if shutil .which ("codex" ) is None :
130132 _die ("Error: 'codex' not found on PATH. Install Codex CLI first." )
131133
134+ result : subprocess .CompletedProcess [str ] | None = None
132135 try :
133136 result = subprocess .run (
134137 ["codex" , "login" , "status" ],
@@ -140,7 +143,7 @@ def preflight() -> None:
140143 f"Error: Failed to execute 'codex' binary found on PATH: { exc } . "
141144 "Check file permissions and binary format."
142145 )
143- if result .returncode != 0 :
146+ if result is None or result .returncode != 0 :
144147 _die ("Error: Codex auth check failed. Run 'codex login' to authenticate." )
145148
146149
0 commit comments