Change summary
crates/task/src/shell_builder.rs | 13 +++++++++++++
crates/task/src/task.rs | 6 +++---
crates/terminal/src/terminal.rs | 2 +-
3 files changed, 17 insertions(+), 4 deletions(-)
Detailed changes
@@ -157,4 +157,17 @@ mod test {
assert_eq!(program, "nu");
assert_eq!(args, vec!["-i", "-c", "(echo nothing) </dev/null"]);
}
+
+ #[test]
+ fn redirect_stdin_to_dev_null_fish() {
+ let shell = Shell::Program("fish".to_owned());
+ let shell_builder = ShellBuilder::new(&shell, false);
+
+ let (program, args) = shell_builder
+ .redirect_stdin_to_dev_null()
+ .build(Some("echo".into()), &["test".to_string()]);
+
+ assert_eq!(program, "fish");
+ assert_eq!(args, vec!["-i", "-c", "begin; echo test; end </dev/null"]);
+ }
}
@@ -355,10 +355,10 @@ impl Shell {
}
}
- pub fn shell_kind(&self) -> ShellKind {
+ pub fn shell_kind(&self, is_windows: bool) -> ShellKind {
match self {
- Shell::Program(program) => ShellKind::new(program),
- Shell::WithArguments { program, .. } => ShellKind::new(program),
+ Shell::Program(program) => ShellKind::new(program, is_windows),
+ Shell::WithArguments { program, .. } => ShellKind::new(program, is_windows),
Shell::System => ShellKind::system(),
}
}
@@ -495,7 +495,7 @@ impl TerminalBuilder {
.unwrap_or(params.program.clone())
});
- let shell_kind = shell.shell_kind();
+ let shell_kind = shell.shell_kind(cfg!(windows));
let pty_options = {
let alac_shell = shell_params.as_ref().map(|params| {