Skip to content

Commit f3e157f

Browse files
authored
Merge pull request #221 from github/copilot/fix-code-review-comment
Align `TestUtil.findCliPath()` lookup order with review feedback
2 parents 62d0fa0 + 96f9cd7 commit f3e157f

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/test/java/com/github/copilot/sdk/TestUtil.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public static String tempPath(String filename) {
3636
* <p>
3737
* Resolution order:
3838
* <ol>
39-
* <li>Search the system PATH using {@code where.exe} (Windows) or {@code which}
40-
* (Linux/macOS).</li>
41-
* <li>Fall back to the {@code COPILOT_CLI_PATH} environment variable.</li>
39+
* <li>Use the {@code COPILOT_CLI_PATH} environment variable when set.</li>
40+
* <li>Otherwise search the system PATH using {@code where.exe} (Windows) or
41+
* {@code which} (Linux/macOS).</li>
4242
* <li>Walk parent directories looking for
4343
* {@code nodejs/node_modules/@github/copilot/index.js}.</li>
4444
* </ol>
@@ -55,16 +55,16 @@ public static String tempPath(String filename) {
5555
* {@code null} if none was found
5656
*/
5757
static String findCliPath() {
58-
String copilotInPath = findCopilotInPath();
59-
if (copilotInPath != null) {
60-
return copilotInPath;
61-
}
62-
6358
String envPath = System.getenv("COPILOT_CLI_PATH");
6459
if (envPath != null && !envPath.isEmpty()) {
6560
return envPath;
6661
}
6762

63+
String copilotInPath = findCopilotInPath();
64+
if (copilotInPath != null) {
65+
return copilotInPath;
66+
}
67+
6868
Path current = Paths.get(System.getProperty("user.dir"));
6969
while (current != null) {
7070
Path cliPath = current.resolve("nodejs/node_modules/@github/copilot/index.js");

0 commit comments

Comments
 (0)