#[cfg(not(windows))]
mod posix;
#[cfg(windows)]
mod windows;
#[cfg(not(windows))]
use posix as inner;
use std::{
fmt,
io::{self, Read},
};
#[cfg(windows)]
use windows as inner;
#[derive(Clone)]
pub struct Pty<'a>(inner::Pty<'a>);
impl fmt::Debug for Pty<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
impl Read for Pty<'_> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
self.0.read(buf)
}
}
pub trait CommandExt: __private::Sealed {
type Output;
fn spawn_pty<'a>(&mut self) -> crate::Result<(Self::Output, Pty<'a>)>;
}
mod __private {
pub trait Sealed {}
impl Sealed for std::process::Command {}
}