From cfa40248bdbd4cfc2e95b725d20cc6acd8239c1e Mon Sep 17 00:00:00 2001 From: zimbatm Date: Fri, 5 Mar 2021 10:57:06 +0100 Subject: [PATCH] formatter: clean the formatter path In cases where the formatter path is relative, the "which" crate doesn't remove the "./" in between. --- src/formatter.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/formatter.rs b/src/formatter.rs index fc4faa6..19c0b1c 100644 --- a/src/formatter.rs +++ b/src/formatter.rs @@ -4,6 +4,7 @@ use crate::{expand_if_path, expand_path}; use anyhow::{anyhow, Result}; use globset::{GlobBuilder, GlobSet, GlobSetBuilder}; use log::debug; +use path_clean::PathClean; use serde::de::{self, Visitor}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::{ @@ -125,7 +126,7 @@ impl Formatter { // Expand the work_dir to an absolute path, using the project root as a reference. let work_dir = expand_path(&cfg.work_dir, tree_root); // Resolve the path to the binary - let command = which(&cfg.command)?; + let command = which(&cfg.command)?.clean(); debug!("Found {} at {}", cfg.command.display(), command.display()); assert!(command.is_absolute());