Drop usage of execSync, switch to $ util

This commit is contained in:
Colin McDonnell
2025-11-20 15:37:08 -08:00
parent 43acacd25a
commit e5878de9e4
7 changed files with 106 additions and 27 deletions
+10 -11
View File
@@ -2,15 +2,14 @@ import { spawnSync } from "child_process";
import { existsSync } from "fs";
function findCliPath(name: string): string | null {
const result = spawnSync("which", [name], { encoding: "utf-8" });
if (result.status === 0 && result.stdout) {
const cliPath = result.stdout.trim();
if (cliPath && existsSync(cliPath)) {
return cliPath;
}
}
return null;
const result = spawnSync("which", [name], { encoding: "utf-8" });
if (result.status === 0 && result.stdout) {
const cliPath = result.stdout.trim();
if (cliPath && existsSync(cliPath)) {
return cliPath;
}
}
console.log(findCliPath("codei"));
return null;
}
console.log(findCliPath("codei"));