When running under WSL, the update command could receive Windows-style absolute paths (e.g., `C:\...`) and pass them to Linux processes unchanged, which fails because WSL expects those paths in `/mnt/<drive>/...` form. This patch adds a tiny helper in the CLI (`cli/src/wsl_paths.rs`) that: - Detects WSL (`WSL_DISTRO_NAME` or `"microsoft"` in `/proc/version`) - Converts `X:\...` → `/mnt/x/...` `run_update_action` now normalizes the package-manager command and arguments under WSL before spawning. Non-WSL platforms are unaffected. Includes small unit tests for the converter. **Fixes:** #6086, #6084 Co-authored-by: Eric Traut <etraut@openai.com>
This commit is contained in:
@@ -26,8 +26,10 @@ use std::path::PathBuf;
|
||||
use supports_color::Stream;
|
||||
|
||||
mod mcp_cmd;
|
||||
mod wsl_paths;
|
||||
|
||||
use crate::mcp_cmd::McpCli;
|
||||
use crate::wsl_paths::normalize_for_wsl;
|
||||
use codex_core::config::Config;
|
||||
use codex_core::config::ConfigOverrides;
|
||||
use codex_core::features::is_known_feature_key;
|
||||
@@ -270,7 +272,11 @@ fn run_update_action(action: UpdateAction) -> anyhow::Result<()> {
|
||||
let (cmd, args) = action.command_args();
|
||||
let cmd_str = action.command_str();
|
||||
println!("Updating Codex via `{cmd_str}`...");
|
||||
let status = std::process::Command::new(cmd).args(args).status()?;
|
||||
let command_path = normalize_for_wsl(cmd);
|
||||
let normalized_args: Vec<String> = args.iter().map(normalize_for_wsl).collect();
|
||||
let status = std::process::Command::new(&command_path)
|
||||
.args(&normalized_args)
|
||||
.status()?;
|
||||
if !status.success() {
|
||||
anyhow::bail!("`{cmd_str}` failed with status {status}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user