mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-09 05:19:32 +08:00
fix: skip extension append if command already has one
Addresses review feedback - now checks path.extname() before appending .cmd to avoid producing invalid paths like npm.cmd.cmd
This commit is contained in:
@@ -16,6 +16,11 @@ function resolveCommand(command: string): string {
|
||||
return command;
|
||||
}
|
||||
const basename = path.basename(command).toLowerCase();
|
||||
// Skip if already has an extension (.cmd, .exe, .bat, etc.)
|
||||
const ext = path.extname(basename);
|
||||
if (ext) {
|
||||
return command;
|
||||
}
|
||||
// Common npm-related commands that need .cmd extension on Windows
|
||||
const cmdCommands = ["npm", "pnpm", "yarn", "npx"];
|
||||
if (cmdCommands.includes(basename)) {
|
||||
|
||||
Reference in New Issue
Block a user