mod pty;
#[cfg(unix)]
pub use pty::{AsyncPty, PtyHandle};
pub use pty::{EnvMode, PtyConfig, PtySpawner, PtyTransport};
#[cfg(windows)]
pub use pty::{WindowsAsyncPty, WindowsPtyHandle};
#[cfg(feature = "ssh")]
pub mod ssh;
pub trait ChildExit {
fn try_exit_status(&mut self) -> Option<crate::types::ProcessExitStatus> {
None
}
}
pub trait Backend {
type Transport;
fn is_available(&self) -> bool;
fn name(&self) -> &'static str;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BackendType {
Pty,
Ssh,
Mock,
}
impl BackendType {
#[must_use]
pub const fn is_available(self) -> bool {
match self {
Self::Pty => cfg!(unix) || cfg!(windows),
Self::Ssh => cfg!(feature = "ssh"),
Self::Mock => cfg!(feature = "mock"),
}
}
#[must_use]
pub const fn name(self) -> &'static str {
match self {
Self::Pty => "pty",
Self::Ssh => "ssh",
Self::Mock => "mock",
}
}
}