From 10bfce13b540a274d6d72c0213fafd7122eb5a3d Mon Sep 17 00:00:00 2001 From: Valentino Zegna Date: Sat, 21 Mar 2026 11:50:46 -0700 Subject: [PATCH] fix: use cmd.exe instead of bash for pstswp.exe invocation bash is not universally available on Windows. Use cmd.exe with native Windows paths, which works on all Windows systems. The cd /d flag handles cross-drive directory changes. Closes #42 --- src/service/tools/cadence-export.ts | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/service/tools/cadence-export.ts b/src/service/tools/cadence-export.ts index 746cd2a..f0054e2 100644 --- a/src/service/tools/cadence-export.ts +++ b/src/service/tools/cadence-export.ts @@ -12,15 +12,6 @@ const serializePstswp = createMutex(); const execAsync = promisify(exec); -/** - * Convert Windows path to bash-compatible path for GitBash/WSL compatibility. - * Example: C:\foo\bar -> /c/foo/bar - */ -const toBashPath = (winPath: string): string => - winPath - .replace(/\\/g, "/") - .replace(/^([A-Za-z]):/, (_, drive: string) => `/${drive.toLowerCase()}`); - /** * Detect installed Cadence SPB versions from the standard installation directory. * @@ -158,16 +149,11 @@ export const exportCadenceNetlist = async ( // Temporarily relocate .DSNlck lock file if present (stale locks block pstswp) const lockTempPath = await relocateLockFile(resolvedDsnPath); - // Convert to bash paths for command execution (GitBash compatibility) - const bashDsnDir = toBashPath(dsnDir); - const pstswp = toBashPath(cadence.pstswp); - const config = toBashPath(cadence.config); - - const command = `cd "${bashDsnDir}" && "${pstswp}" -pst -d "${dsnFile}" -n "${outputDirName}" -c "${config}" -v 3 -l 255 -j "PCB Footprint"`; + const command = `cd /d "${dsnDir}" && "${cadence.pstswp}" -pst -d "${dsnFile}" -n "${outputDirName}" -c "${cadence.config}" -v 3 -l 255 -j "PCB Footprint"`; try { const { stdout, stderr } = await execAsync(command, { - shell: "bash", + shell: "cmd.exe", timeout: 120000, });