From 220b99a9fabf10fad83a570f641ad39737d85875 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Sun, 5 Jul 2026 20:18:24 +0300 Subject: fix: support custom command keybindings on windows refs #1041 --- src/platform/mod.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/platform/mod.rs') 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, @@ -198,6 +206,29 @@ impl PrefixInputSource for RealPrefixInputSource { 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::>(), + [ + std::ffi::OsStr::new("-lc"), + std::ffi::OsStr::new("echo hello") + ] + ); + } + + #[test] + fn pane_custom_command_builder_preserves_unix_shell_flag() { + let expected: Vec = + 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()); -- cgit v1.2.3