pub struct ServerPty { /* private fields */ }
Expand description
An object used for interacting with the shell.
Implementations§
source§impl ServerPty
impl ServerPty
sourcepub fn new() -> Result<Self, Error>
pub fn new() -> Result<Self, Error>
Creates a new instance of the Pty which must later be spawned.
sourcepub async fn spawn(
self,
command: Option<&CStr>,
environ: Option<&[&CStr]>
) -> Result<ShellProcess, Error>
pub async fn spawn( self, command: Option<&CStr>, environ: Option<&[&CStr]> ) -> Result<ShellProcess, Error>
Spawns the Pty.
If no command is provided the default /boot/bin/sh will be used.
After calling this method the user must call resize to give the process a valid window size before it will respond.
The launched process will close when the Pty is dropped so you do not need to explicitly close it.
pub async fn spawn_with_argv( self, command: &CStr, argv: &[&CStr], environ: Option<&[&CStr]> ) -> Result<ShellProcess, Error>
sourcepub fn try_clone_fd(&self) -> Result<File, Error>
pub fn try_clone_fd(&self) -> Result<File, Error>
Attempts to clone the server side of the file descriptor.
sourcepub async fn resize(&self, window_size: WindowSize) -> Result<(), Error>
pub async fn resize(&self, window_size: WindowSize) -> Result<(), Error>
Sends a message to the shell that the window has been resized.
sourcepub async fn open_client(
&self,
server_end: ServerEnd<DeviceMarker>
) -> Result<(), Error>
pub async fn open_client( &self, server_end: ServerEnd<DeviceMarker> ) -> Result<(), Error>
Open a client Pty device. server_end
should be a handle
to one endpoint of a channel that (on success) will become an open
connection to the newly created device.