Skip to content

Commit 3472714

Browse files
brettcannonSteveSandersonMS
authored andcommitted
Improve CLI path verification in CopilotClient to use shutil.which
1 parent a175956 commit 3472714

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

python/copilot/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import inspect
1717
import os
1818
import re
19+
import shutil
1920
import subprocess
2021
import sys
2122
import threading
@@ -1268,7 +1269,8 @@ async def _start_cli_server(self) -> None:
12681269

12691270
# Verify CLI exists
12701271
if not os.path.exists(cli_path):
1271-
raise RuntimeError(f"Copilot CLI not found at {cli_path}")
1272+
if (cli_path := shutil.which(cli_path)) is None:
1273+
raise RuntimeError(f"Copilot CLI not found at {cli_path}")
12721274

12731275
# Start with user-provided cli_args, then add SDK-managed args
12741276
args = list(cfg.cli_args) + [

0 commit comments

Comments
 (0)