v0.2.3 : execution shell des commandes avec pipe (rustup, bun, uv) + rafraichissement du PATH + python3 satisfait python
This commit is contained in:
+15
-16
@@ -65,7 +65,12 @@ pub fn run(app: &App, runner: &dyn Runner) -> DoctorReport {
|
||||
];
|
||||
let os = crate::toolchain::OsInfo::detect();
|
||||
for (tool, required) in tools {
|
||||
match runner.which(tool) {
|
||||
let found = if *tool == "python" {
|
||||
runner.which("python3").or_else(|| runner.which("python"))
|
||||
} else {
|
||||
runner.which(tool)
|
||||
};
|
||||
match found {
|
||||
Some(path) => {
|
||||
let mut detail = path.display().to_string();
|
||||
let empty = BTreeMap::new();
|
||||
@@ -211,8 +216,8 @@ fn is_on_path(dir: &std::path::Path) -> bool {
|
||||
pub fn install_missing_tools(app: &App, runner: &dyn Runner) -> Result<Vec<String>> {
|
||||
let mut installed = Vec::new();
|
||||
let os = crate::toolchain::OsInfo::detect();
|
||||
for tool in ["node", "python", "cargo", "go", "bun", "uv", "docker"] {
|
||||
if runner.which(tool).is_some() {
|
||||
for tool in ["git", "node", "python", "cargo", "go", "bun", "uv", "docker"] {
|
||||
if crate::toolchain::tool_is_present(tool, runner) {
|
||||
continue;
|
||||
}
|
||||
let cmds = crate::toolchain::install_commands(tool, &os);
|
||||
@@ -225,19 +230,13 @@ pub fn install_missing_tools(app: &App, runner: &dyn Runner) -> Result<Vec<Strin
|
||||
))? {
|
||||
continue;
|
||||
}
|
||||
if let Ok(tokens) = shell_words::split(cmd) {
|
||||
if !tokens.is_empty() {
|
||||
let prog = tokens[0].clone();
|
||||
let args: Vec<String> = tokens[1..].to_vec();
|
||||
let empty = BTreeMap::new();
|
||||
let out = runner.run(&prog, &args, &empty, None, false)?;
|
||||
installed.push(if out.code == 0 {
|
||||
format!("installed '{tool}' ({cmd})")
|
||||
} else {
|
||||
format!("failed to install '{tool}' (exit code {})", out.code)
|
||||
});
|
||||
}
|
||||
}
|
||||
let code = crate::toolchain::run_install_command(runner, cmd)?;
|
||||
crate::toolchain::refresh_path();
|
||||
installed.push(if code == 0 {
|
||||
format!("installed '{tool}' ({cmd})")
|
||||
} else {
|
||||
format!("failed to install '{tool}' (exit code {code})")
|
||||
});
|
||||
}
|
||||
Ok(installed)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user