From aca64c09f85fcb1beac8bdea5e3e8cb1293de44b Mon Sep 17 00:00:00 2001 From: Thayne McCombs Date: Sun, 9 Oct 2022 01:25:03 -0600 Subject: [PATCH] Actually test if exec or exec-batch is used By the time we check if we should strip the cwd, we've already moved the command out of the options, so store if we got that out earlier. --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 1288423..9888b02 100644 --- a/src/main.rs +++ b/src/main.rs @@ -208,6 +208,7 @@ fn construct_config(mut opts: Opts, pattern_regex: &str) -> Result { None }; let command = extract_command(&mut opts, colored_output)?; + let has_command = command.is_some(); Ok(Config { case_sensitive, @@ -280,7 +281,7 @@ fn construct_config(mut opts: Opts, pattern_regex: &str) -> Result { actual_path_separator, max_results: opts.max_results(), strip_cwd_prefix: (opts.no_search_paths() - && (opts.strip_cwd_prefix || !(opts.null_separator || opts.exec.command.is_some()))), + && (opts.strip_cwd_prefix || !(opts.null_separator || has_command))), }) }