You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-08-25 20:29:09 +02:00
Uninstall old mdbook-linkcheck while installing project tools. (#2846)
Fixes #2773 .
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
use anyhow::{Ok, Result, anyhow};
|
use anyhow::{Ok, Result, anyhow};
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
use std::process::Stdio;
|
||||||
use std::{env, process::Command};
|
use std::{env, process::Command};
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
@@ -128,9 +129,35 @@ fn install_tools() -> Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Uninstall original linkcheck if currently installed (see issue no 2773)
|
||||||
|
uninstall_mdbook_linkcheck();
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn uninstall_mdbook_linkcheck() {
|
||||||
|
println!("Uninstalling old mdbook-linkcheck if installed...");
|
||||||
|
let output = Command::new(env!("CARGO"))
|
||||||
|
.arg("uninstall")
|
||||||
|
.arg("mdbook-linkcheck")
|
||||||
|
.output()
|
||||||
|
.expect("Failed to execute cargo uninstall mdbook-linkcheck");
|
||||||
|
|
||||||
|
if !output.status.success() {
|
||||||
|
if String::from_utf8_lossy(&output.stderr)
|
||||||
|
.into_owned()
|
||||||
|
.contains("did not match any packages")
|
||||||
|
{
|
||||||
|
println!("mdbook-linkcheck not installed. Continuing...");
|
||||||
|
} else {
|
||||||
|
eprintln!(
|
||||||
|
"An error occurred during uninstallation of mdbook-linkcheck:\n{:#?}",
|
||||||
|
String::from_utf8_lossy(&output.stderr)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn run_web_tests(dir: Option<PathBuf>) -> Result<()> {
|
fn run_web_tests(dir: Option<PathBuf>) -> Result<()> {
|
||||||
println!("Running web tests...");
|
println!("Running web tests...");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user