diff options
author | David Knaack <davidkna@users.noreply.github.com> | 2021-07-16 21:20:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-16 15:20:59 -0400 |
commit | 1eaf996a3645704910ea30b0ee19a97ab4f1daf6 (patch) | |
tree | 91345555c552039d24615f2251bfd3db9187c6e6 /src/modules/hg_branch.rs | |
parent | e1fc137dc9b7fe4f992884b9984d8c1dba103370 (diff) |
fix(windows): avoid inadvertly running exes from cwd (#2885)
On Windows when running commands with their name instead of the path with Command::new, executable with that name from the current working directory will be executed.
This PR replaces all instances of Command::new with a new create_command function which will first resolve any executable paths and avoid this issue.
Diffstat (limited to 'src/modules/hg_branch.rs')
-rw-r--r-- | src/modules/hg_branch.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/modules/hg_branch.rs b/src/modules/hg_branch.rs index b0d19edbb..a30c2a538 100644 --- a/src/modules/hg_branch.rs +++ b/src/modules/hg_branch.rs @@ -103,9 +103,9 @@ mod tests { use std::fs; use std::io; use std::path::Path; - use std::process::Command; use crate::test::{fixture_repo, FixtureProvider, ModuleRenderer}; + use crate::utils::create_command; enum Expect<'a> { BranchName(&'a str), @@ -335,7 +335,7 @@ mod tests { } fn run_hg(args: &[&str], repo_dir: &Path) -> io::Result<()> { - Command::new("hg") + create_command("hg")? .args(args) .current_dir(&repo_dir) .output()?; |