()
| 180 | |
| 181 | @functools.lru_cache(maxsize=1) |
| 182 | def interactive_shell_path() -> str | None: |
| 183 | shell = os.environ.get("SHELL") |
| 184 | if not shell: |
| 185 | return None |
| 186 | |
| 187 | shell_name = Path(shell).name |
| 188 | if shell_name not in {"bash", "zsh"}: |
| 189 | return None |
| 190 | |
| 191 | try: |
| 192 | result = subprocess.run( |
| 193 | [shell, "-lic", 'printf "%s" "$PATH"'], |
| 194 | capture_output=True, |
| 195 | check=True, |
| 196 | cwd=ROOT_DIR, |
| 197 | text=True, |
| 198 | ) |
| 199 | except (OSError, subprocess.SubprocessError): |
| 200 | return None |
| 201 | |
| 202 | path_value = result.stdout.strip() |
| 203 | return path_value or None |
| 204 | |
| 205 | |
| 206 | def build_command_path(base_path: str | None = None) -> str: |
no test coverage detected