pub struct PtyConfig {
pub working_directory: Option<PathBuf>,
pub env: Option<HashMap<OsString, OsString>>,
pub env_add: HashMap<OsString, OsString>,
pub env_remove: Vec<OsString>,
pub window_size: (u16, u16),
pub new_session: bool,
pub spawn_timeout: Option<Duration>,
pub controlling_terminal: bool,
}Expand description
Configuration for creating a new PTY session.
§Example
use rust_pty::PtyConfig;
let config = PtyConfig::builder()
.working_directory("/home/user")
.env("TERM", "xterm-256color")
.window_size(80, 24)
.build();Fields§
§working_directory: Option<PathBuf>Working directory for the child process.
env: Option<HashMap<OsString, OsString>>Environment variables to set for the child process. If None, inherits from the parent process.
env_add: HashMap<OsString, OsString>Additional environment variables to add (merged with inherited).
env_remove: Vec<OsString>Environment variables to remove from inherited environment.
window_size: (u16, u16)Initial window size (columns, rows).
new_session: boolWhether to create a new session (Unix setsid).
spawn_timeout: Option<Duration>Timeout for spawn operation.
controlling_terminal: boolWhether to use a controlling terminal (Unix).
Implementations§
Source§impl PtyConfig
impl PtyConfig
Sourcepub fn builder() -> PtyConfigBuilder
pub fn builder() -> PtyConfigBuilder
Create a new builder for PtyConfig.
Sourcepub fn effective_env(&self) -> HashMap<OsString, OsString>
pub fn effective_env(&self) -> HashMap<OsString, OsString>
Get the effective environment for the child process.
This merges the base environment (inherited or explicit), adds
variables from env_add, and removes variables from env_remove.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PtyConfig
impl RefUnwindSafe for PtyConfig
impl Send for PtyConfig
impl Sync for PtyConfig
impl Unpin for PtyConfig
impl UnwindSafe for PtyConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more