mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-10 06:20:13 +00:00
fix(websearch): use 'where' command on Windows for CLI detection
Fixes #273 The websearch-transformer hook used hardcoded 'which' command which doesn't exist on Windows. Now uses process.platform detection to choose 'where' on Windows and 'which' on Unix systems.
This commit is contained in:
@@ -154,7 +154,10 @@ process.stdin.on('error', () => {
|
|||||||
*/
|
*/
|
||||||
function isCliAvailable(cmd) {
|
function isCliAvailable(cmd) {
|
||||||
try {
|
try {
|
||||||
const result = spawnSync('which', [cmd], {
|
const isWindows = process.platform === 'win32';
|
||||||
|
const whichCmd = isWindows ? 'where.exe' : 'which';
|
||||||
|
|
||||||
|
const result = spawnSync(whichCmd, [cmd], {
|
||||||
encoding: 'utf8',
|
encoding: 'utf8',
|
||||||
timeout: 2000,
|
timeout: 2000,
|
||||||
stdio: ['pipe', 'pipe', 'pipe'],
|
stdio: ['pipe', 'pipe', 'pipe'],
|
||||||
|
|||||||
Reference in New Issue
Block a user