in codex-cli/src/utils/agent/platform-commands.ts [44:82]
export function adaptCommandForPlatform(command: Array<string>): Array<string> {
// If not on Windows, return the original command
if (process.platform !== "win32") {
return command;
}
// Nothing to adapt if the command is empty
if (command.length === 0) {
return command;
}
const cmd = command[0];
// If cmd is undefined or the command doesn't need adaptation, return it as is
if (!cmd || !COMMAND_MAP[cmd]) {
return command;
}
log(`Adapting command '${cmd}' for Windows platform`);
// Create a new command array with the adapted command
const adaptedCommand = [...command];
adaptedCommand[0] = COMMAND_MAP[cmd];
// Adapt options if needed
const optionsForCmd = OPTION_MAP[cmd];
if (optionsForCmd) {
for (let i = 1; i < adaptedCommand.length; i++) {
const option = adaptedCommand[i];
if (option && optionsForCmd[option]) {
adaptedCommand[i] = optionsForCmd[option];
}
}
}
log(`Adapted command: ${adaptedCommand.join(" ")}`);
return adaptedCommand;
}