From 5aef725171f9d0aeda0ef921185abce0908ea7ba Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 27 Mar 2021 07:25:00 -0700 Subject: [PATCH] pty: unconditionally export some unix+ssh specific things These were gated to the ssh feature, but I want to use them with wezterm-ssh, and externally defined ssh pty implementation. --- pty/src/cmdbuilder.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pty/src/cmdbuilder.rs b/pty/src/cmdbuilder.rs index 924ed57c3..9f37e00f3 100644 --- a/pty/src/cmdbuilder.rs +++ b/pty/src/cmdbuilder.rs @@ -100,13 +100,8 @@ impl CommandBuilder { self.cwd.as_ref() } - #[cfg(unix)] - pub fn umask(&mut self, mask: Option) { - self.umask = mask; - } - - #[cfg(feature = "ssh")] - pub(crate) fn iter_env_as_str(&self) -> impl Iterator { + /// Iterate over the configured environment + pub fn iter_env_as_str(&self) -> impl Iterator { self.envs.iter().filter_map(|(key, val)| { let key = key.to_str()?; let val = val.to_str()?; @@ -114,8 +109,9 @@ impl CommandBuilder { }) } - #[cfg(feature = "ssh")] - pub(crate) fn as_unix_command_line(&self) -> anyhow::Result { + /// Return the configured command and arguments as a single string, + /// quoted per the unix shell conventions. + pub fn as_unix_command_line(&self) -> anyhow::Result { let mut strs = vec![]; for arg in &self.args { let s = arg @@ -129,6 +125,10 @@ impl CommandBuilder { #[cfg(unix)] impl CommandBuilder { + pub fn umask(&mut self, mask: Option) { + self.umask = mask; + } + /// Convert the CommandBuilder to a `std::process::Command` instance. pub(crate) fn as_command(&self) -> anyhow::Result { let mut cmd = if self.is_default_prog() {