@fclef819/cdx 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cdx.js +16 -1
- package/package.json +1 -1
package/bin/cdx.js
CHANGED
|
@@ -164,7 +164,22 @@ function runCodex(args, cwd, verbose) {
|
|
|
164
164
|
const result = spawnSync("codex", args, { stdio: "inherit", cwd });
|
|
165
165
|
if (result.error) {
|
|
166
166
|
if (result.error.code === "ENOENT" && process.platform === "win32") {
|
|
167
|
-
logVerbose("codex not found directly; trying
|
|
167
|
+
logVerbose("codex not found directly; trying where.exe lookup", verbose);
|
|
168
|
+
const whereResult = spawnSync("where.exe", ["codex"], { encoding: "utf8" });
|
|
169
|
+
const resolved = whereResult.stdout
|
|
170
|
+
? whereResult.stdout.split(/\r?\n/).find(Boolean)
|
|
171
|
+
: null;
|
|
172
|
+
if (resolved) {
|
|
173
|
+
logVerbose(`Resolved codex path: ${resolved}`, verbose);
|
|
174
|
+
const resolvedResult = spawnSync(resolved, args, {
|
|
175
|
+
stdio: "inherit",
|
|
176
|
+
cwd
|
|
177
|
+
});
|
|
178
|
+
if (!resolvedResult.error) {
|
|
179
|
+
return { status: resolvedResult.status ?? 0 };
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
logVerbose("codex not found via where.exe; trying PowerShell fallback", verbose);
|
|
168
183
|
const psArgs = [
|
|
169
184
|
"-NoProfile",
|
|
170
185
|
"-Command",
|