mirror of
https://github.com/zellij-org/zellij.git
synced 2024-11-22 22:26:54 +03:00
fix(plugins): respect default shell when configured in the $SHELL env variable (#3296)
* fix(plugins): respect $SHELL alias for default shell * style(fmt): rustfmt * fix tests
This commit is contained in:
parent
fca7a209d2
commit
5e587333b5
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: zellij-server/src/plugins/./unit/plugin_tests.rs
|
||||
assertion_line: 4246
|
||||
assertion_line: 4390
|
||||
expression: "format!(\"{:#?}\", new_tab_event)"
|
||||
---
|
||||
Some(
|
||||
@ -8,7 +8,7 @@ Some(
|
||||
Some(
|
||||
RunCommand(
|
||||
RunCommand {
|
||||
command: "",
|
||||
command: ".",
|
||||
args: [],
|
||||
cwd: Some(
|
||||
"/path/to/my/file.rs",
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: zellij-server/src/plugins/./unit/plugin_tests.rs
|
||||
assertion_line: 4169
|
||||
assertion_line: 4312
|
||||
expression: "format!(\"{:#?}\", new_tab_event)"
|
||||
---
|
||||
Some(
|
||||
@ -8,7 +8,7 @@ Some(
|
||||
Some(
|
||||
RunCommand(
|
||||
RunCommand {
|
||||
command: "",
|
||||
command: ".",
|
||||
args: [],
|
||||
cwd: Some(
|
||||
"/path/to/my/file.rs",
|
||||
|
@ -515,11 +515,12 @@ fn open_file_in_place(env: &ForeignFunctionEnv, file_to_open: FileToOpen) {
|
||||
fn open_terminal(env: &ForeignFunctionEnv, cwd: PathBuf) {
|
||||
let error_msg = || format!("failed to open file in plugin {}", env.plugin_env.name());
|
||||
let cwd = env.plugin_env.plugin_cwd.join(cwd);
|
||||
let mut default_shell = env
|
||||
.plugin_env
|
||||
.default_shell
|
||||
.clone()
|
||||
.unwrap_or_else(|| TerminalAction::RunCommand(RunCommand::default()));
|
||||
let mut default_shell = env.plugin_env.default_shell.clone().unwrap_or_else(|| {
|
||||
TerminalAction::RunCommand(RunCommand {
|
||||
command: env.plugin_env.path_to_default_shell.clone(),
|
||||
..Default::default()
|
||||
})
|
||||
});
|
||||
default_shell.change_cwd(cwd);
|
||||
let run_command_action: Option<RunCommandAction> = match default_shell {
|
||||
TerminalAction::RunCommand(run_command) => Some(run_command.into()),
|
||||
@ -536,11 +537,12 @@ fn open_terminal_floating(
|
||||
) {
|
||||
let error_msg = || format!("failed to open file in plugin {}", env.plugin_env.name());
|
||||
let cwd = env.plugin_env.plugin_cwd.join(cwd);
|
||||
let mut default_shell = env
|
||||
.plugin_env
|
||||
.default_shell
|
||||
.clone()
|
||||
.unwrap_or_else(|| TerminalAction::RunCommand(RunCommand::default()));
|
||||
let mut default_shell = env.plugin_env.default_shell.clone().unwrap_or_else(|| {
|
||||
TerminalAction::RunCommand(RunCommand {
|
||||
command: env.plugin_env.path_to_default_shell.clone(),
|
||||
..Default::default()
|
||||
})
|
||||
});
|
||||
default_shell.change_cwd(cwd);
|
||||
let run_command_action: Option<RunCommandAction> = match default_shell {
|
||||
TerminalAction::RunCommand(run_command) => Some(run_command.into()),
|
||||
@ -553,11 +555,12 @@ fn open_terminal_floating(
|
||||
fn open_terminal_in_place(env: &ForeignFunctionEnv, cwd: PathBuf) {
|
||||
let error_msg = || format!("failed to open file in plugin {}", env.plugin_env.name());
|
||||
let cwd = env.plugin_env.plugin_cwd.join(cwd);
|
||||
let mut default_shell = env
|
||||
.plugin_env
|
||||
.default_shell
|
||||
.clone()
|
||||
.unwrap_or_else(|| TerminalAction::RunCommand(RunCommand::default()));
|
||||
let mut default_shell = env.plugin_env.default_shell.clone().unwrap_or_else(|| {
|
||||
TerminalAction::RunCommand(RunCommand {
|
||||
command: env.plugin_env.path_to_default_shell.clone(),
|
||||
..Default::default()
|
||||
})
|
||||
});
|
||||
default_shell.change_cwd(cwd);
|
||||
let run_command_action: Option<RunCommandAction> = match default_shell {
|
||||
TerminalAction::RunCommand(run_command) => Some(run_command.into()),
|
||||
|
Loading…
Reference in New Issue
Block a user