refactor(brush-core-vendored): fixed PATHEXT handling for Windows executable discovery

- Refactored ExecutablePathSearch to remove generic type parameter N and use pre-computed filename candidates instead of single filename.
- Extracted platform-specific candidate_filenames() functions to generate executable filename variants on Windows and Unix-like systems.
- Replaced manual PATH string splitting with std::env::split_paths() for cross-platform path parsing.
- Simplified find_in_path() method to delegate to pathsearch::search_for_executable() instead of custom path searching logic.
- Implemented executable_extensions() function with lazy initialization to parse PATHEXT environment variable on Windows.
- Enhanced executable() method to validate file extensions against known executable extensions instead of returning hardcoded true.
This commit is contained in:
can1357
2026-02-04 10:37:51 +01:00
parent e425ed502a
commit b9938ada49
5 changed files with 86 additions and 23 deletions
@@ -1,6 +1,6 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test";
import { PythonKernel } from "@oh-my-pi/pi-coding-agent/ipy/kernel";
import * as gatewayCoordinator from "@oh-my-pi/pi-coding-agent/ipy/gateway-coordinator";
import { PythonKernel } from "@oh-my-pi/pi-coding-agent/ipy/kernel";
import { TempDir } from "@oh-my-pi/pi-utils";
import type { Subprocess } from "bun";