Skip to main content

open_pty

Function open_pty 

Source
pub fn open_pty() -> Result<(File, File)>
Expand description

Opens a PTY pair, returning (primary, secondary).

Both fds have O_CLOEXEC set atomically at open time so they cannot leak into child processes even under concurrent fork. Callers that need the secondary in a child should pass it via Stdio::from(), which dup2s it onto stdin/stdout/stderr.