No need to run which in WSL (fix #694) (#707)

* No need to run which in WSL (fix #694)

* clippy
This commit is contained in:
Roey Darwish Dror
2021-05-10 09:40:23 +03:00
committed by GitHub
parent 54055a5e10
commit ac4c23929e

View File

@@ -1,9 +1,9 @@
use crate::execution_context::ExecutionContext;
use crate::executor::{CommandExt, RunType};
use crate::executor::RunType;
use crate::powershell;
use crate::steps::git::Repositories;
use crate::terminal::print_separator;
use crate::utils::require;
use crate::{error::SkipStep, steps::git::Repositories};
use anyhow::Result;
use log::debug;
use std::convert::TryFrom;
@@ -52,15 +52,8 @@ pub fn run_scoop(cleanup: bool, run_type: RunType) -> Result<()> {
pub fn run_wsl_topgrade(ctx: &ExecutionContext) -> Result<()> {
let wsl = require("wsl")?;
let topgrade = Command::new(&wsl)
.args(&["bash", "-lc", "which topgrade"])
.check_output()
.map_err(|_| SkipStep(String::from("Could not find Topgrade installed in WSL")))?;
let mut command = ctx.run_type().execute(&wsl);
command
.args(&["bash", "-c"])
.arg(format!("TOPGRADE_PREFIX=WSL exec {}", topgrade));
command.args(&["bash", "-lc"]).arg("TOPGRADE_PREFIX=WSL exec topgrade");
if ctx.config().yes() {
command.arg("-y");