summaryrefslogtreecommitdiffstats
path: root/src/verb/external_execution.rs
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2020-08-18 20:08:31 +0200
committerCanop <cano.petrole@gmail.com>2020-08-18 20:08:31 +0200
commitf8b26f7533560ea575c4835baaab1c8a0bcdb8d9 (patch)
tree09b9a52defba696c2751c0ca6d41ef6135db47e5 /src/verb/external_execution.rs
parent9ccb5a397e2447b5dcd570621b9a23d89879b3fd (diff)
setting the working dir of processes is now opt-in
This is defined with set_working_dir = true
Diffstat (limited to 'src/verb/external_execution.rs')
-rw-r--r--src/verb/external_execution.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/verb/external_execution.rs b/src/verb/external_execution.rs
index 0e87af2..3d3b0d4 100644
--- a/src/verb/external_execution.rs
+++ b/src/verb/external_execution.rs
@@ -61,8 +61,12 @@ pub struct ExternalExecution {
pub arg_anchor: PathAnchor,
- // /// whether we need to have a secondary panel for execution
- // /// (which is the case when an invocation has {other-panel-file})
+ /// whether the working dir of the external process must be set
+ /// to the current directory
+ pub set_working_dir: bool,
+
+ /// whether we need to have a secondary panel for execution
+ /// (which is the case when an invocation has {other-panel-file})
pub need_another_panel: bool,
}
@@ -112,6 +116,7 @@ impl ExternalExecution {
arg_selection_type,
arg_anchor,
need_another_panel,
+ set_working_dir: false,
})
}
@@ -258,7 +263,11 @@ impl ExternalExecution {
) -> Result<AppStateCmdResult, ProgramError> {
let launchable = Launchable::program(
self.exec_token(sel, other_file, args),
- path::closest_dir(sel.path),
+ if self.set_working_dir {
+ Some(path::closest_dir(sel.path))
+ } else {
+ None
+ },
)?;
if self.exec_mode.is_leave_broot() {
Ok(AppStateCmdResult::from(launchable))