Fixed bug where setting the current directory was impossible on UNIX for non-default terminal commands

This commit is contained in:
john01dav authored and Wez Furlong committed 2020-07-18 08:40:58 -07:00
1 parent f64b268edd
commit f2327de74d
1 file changed
+8
+8
View File
@@ -134,6 +134,14 @@ impl CommandBuilder {
} else {
let mut cmd = std::process::Command::new(&self.args[0]);
cmd.args(&self.args[1..]);
let home = Self::get_home_dir()?;
let dir: &OsStr = self
.cwd
.as_ref()
.map(|dir| dir.as_os_str())
.filter(|dir| std::path::Path::new(dir).is_dir())
.unwrap_or(home.as_ref());
cmd.current_dir(dir);
cmd
};