diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-05 20:18:24 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-05 20:19:13 +0300 |
| commit | 220b99a9fabf10fad83a570f641ad39737d85875 (patch) | |
| tree | a27a3b791f110d091ca6ef9b194bb6c1fb4e2b55 /src/platform/mod.rs | |
| parent | 2bc1724c2dae72184a5d2ec070e30c70dc519f9b (diff) | |
fix: support custom command keybindings on windows
refs #1041
Diffstat (limited to 'src/platform/mod.rs')
| -rw-r--r-- | src/platform/mod.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/platform/mod.rs b/src/platform/mod.rs index 889c4ce9..e396966b 100644 --- a/src/platform/mod.rs +++ b/src/platform/mod.rs @@ -25,6 +25,14 @@ pub enum Signal { Kill, } +pub(crate) fn detached_custom_command_process(command: &str) -> std::process::Command { + detached_custom_command_process_platform(command) +} + +pub(crate) fn pane_custom_command_pty_builder(command: &str) -> portable_pty::CommandBuilder { + pane_custom_command_pty_builder_platform(command) +} + #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub(crate) struct PlatformCapabilities { pub(crate) live_handoff: bool, @@ -199,6 +207,29 @@ mod tests { use super::*; #[test] + fn detached_custom_command_preserves_unix_login_shell_flag() { + let cmd = detached_custom_command_process("echo hello"); + assert_eq!(cmd.get_program(), std::ffi::OsStr::new("/bin/sh")); + assert_eq!( + cmd.get_args().collect::<Vec<_>>(), + [ + std::ffi::OsStr::new("-lc"), + std::ffi::OsStr::new("echo hello") + ] + ); + } + + #[test] + fn pane_custom_command_builder_preserves_unix_shell_flag() { + let expected: Vec<std::ffi::OsString> = + vec!["/bin/sh".into(), "-c".into(), "echo hello".into()]; + assert_eq!( + pane_custom_command_pty_builder("echo hello").get_argv(), + &expected + ); + } + + #[test] fn read_limited_reader_returns_complete_data_under_limit() { let input = std::io::Cursor::new(b"image".to_vec()); assert_eq!( |
