From 785bf113005d2b1d7dd144f479d11f6b2aff88b4 Mon Sep 17 00:00:00 2001 From: Manuel <2084639+tennox@users.noreply.github.com> Date: Sat, 22 Oct 2022 11:48:32 +0100 Subject: [PATCH] Backwards compatibility with fisher v3 (#55) --- src/steps/os/unix.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/steps/os/unix.rs b/src/steps/os/unix.rs index b392749c..4075d0fd 100644 --- a/src/steps/os/unix.rs +++ b/src/steps/os/unix.rs @@ -88,7 +88,19 @@ pub fn run_fisher(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> { print_separator("Fisher"); - run_type.execute(&fish).args(&["-c", "fisher update"]).check_run() + let version_str = run_type + .execute(&fish) + .args(&["-c", "fisher --version"]) + .check_output()?; + debug!("Fisher version: {}", version_str); + + if version_str.starts_with("fisher version 3.") { + // v3 - see https://github.com/topgrade-rs/topgrade/pull/37#issuecomment-1283844506 + run_type.execute(&fish).args(&["-c", "fisher"]).check_run() + } else { + // v4 + run_type.execute(&fish).args(&["-c", "fisher update"]).check_run() + } } pub fn run_bashit(ctx: &ExecutionContext) -> Result<()> {