Commit 6384c69
fix: remove duplicate version warning and include CLI path (#720)
## Summary
Two small fixes to the CLI version warning in `_check_claude_version()`:
1. **Remove duplicate output** — The warning was emitted twice: once via
`logger.warning()` and again via `print(..., file=sys.stderr)`. Users
saw the same message repeated. Now only `logger.warning()` is used,
which is the standard library approach for warning output.
2. **Include CLI path in the warning** — When the version is below
minimum, the warning now shows which CLI binary was found (e.g.,
`/opt/node22/bin/claude`), making it easier to diagnose when multiple
CLI installations exist.
Fixes #359, fixes #360
## Changes
- `subprocess_cli.py`: Replace `print()` + `logger.warning(f"...")` with
a single `logger.warning("...", ...)` using lazy `%s` formatting
- `subprocess_cli.py`: Remove now-unused `import sys`
- `test_transport.py`: Add two regression tests:
- `test_version_warning_includes_cli_path` — verifies the warning
includes version and CLI path, and that `print()` is not called
- `test_version_warning_not_emitted_for_current_version` — verifies no
warning for versions at or above minimum
## Verification
- All 329 tests pass (`pytest tests/`)
- Lint clean (`ruff check src/ tests/`)
- Type check clean (`mypy src/`)
- E2E verified with live SDK instance (v0.1.50, CLI 2.1.83) — query
completes successfully
Co-authored-by: Claude <noreply@anthropic.com>1 parent d3d71fb commit 6384c69
2 files changed
Lines changed: 80 additions & 7 deletions
Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
625 | 624 | | |
626 | 625 | | |
627 | 626 | | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
632 | 634 | | |
633 | | - | |
634 | | - | |
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1064 | 1064 | | |
1065 | 1065 | | |
1066 | 1066 | | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
0 commit comments