diff options
author | Dan Davison <dandavison7@gmail.com> | 2021-07-10 15:52:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-10 15:52:06 +0100 |
commit | f01846bd443aaf92fdd5ac20f461beac3f6ee3fd (patch) | |
tree | c149a80974da3d6d90e88c63019846202bf58461 /src/main.rs | |
parent | 2826bdd75b31f42aac1c80b2302c25e739a8adf1 (diff) |
Do not resolve executables as relative path from current directory (#658)0.8.3
* Refactor: child pager process creation
* Protect calls to Command::new behind grep_cli::resolve_binary
* Move less env-var setting into less-specific branch
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index 94b4c745..c388f492 100644 --- a/src/main.rs +++ b/src/main.rs @@ -132,7 +132,11 @@ You can also use delta to diff two files: `delta file_A file_B`." let diff_command = "git"; let minus_file = minus_file.unwrap_or_else(die); let plus_file = plus_file.unwrap_or_else(die); - let mut diff_process = process::Command::new(PathBuf::from(diff_command)) + let diff_command_path = match grep_cli::resolve_binary(PathBuf::from(diff_command)) { + Ok(path) => path, + Err(_) => return config.error_exit_code, + }; + let mut diff_process = process::Command::new(diff_command_path) .args(&["diff", "--no-index"]) .args(&[minus_file, plus_file]) .stdout(process::Stdio::piped()) |