Trait term_transcript::traits::SpawnShell [−][src]
pub trait SpawnShell: ConfigureCommand {
type ShellProcess: ShellProcess;
type Reader: Read + 'static + Send;
type Writer: Write + 'static + Send;
fn spawn_shell(&mut self) -> Result<SpawnedShell<Self>>;
}Expand description
Encapsulates spawning and sending inputs / receiving outputs from the shell.
The crate provides two principal implementations of this trait:
CommandandStdShellcommunicate with the spawned process via OS pipes. Because stdin of the child process is not connected to a terminal / TTY, this can lead to the differences in output compared to launching the process in a terminal (no coloring, different formatting, etc.). On the other hand, this is the most widely supported option.PtyCommand(available with theportable-ptycrate feature) communicates with the child process via a pseudo-terminal (PTY). This makes the output closer to what it would like in the terminal, at the cost of lesser platform coverage (Unix + newer Windows distributions).
External implementations are possible as well! E.g., for REPL applications written in Rust or packaged as a WASI module, it could be possible to write an implementation that “spawns” the application in the same process.
Associated Types
Spawned shell process.
Required methods
fn spawn_shell(&mut self) -> Result<SpawnedShell<Self>>
fn spawn_shell(&mut self) -> Result<SpawnedShell<Self>>
Spawns a shell process.
Errors
Returns an error if the shell process cannot be spawned for whatever reason.
Implementations on Foreign Types
Uses pipes to communicate with the spawned process. This has a potential downside that
the process output will differ from the case if the process was launched in the shell.
See PtyCommand for an alternative that connects the spawned process to a pseudo-terminal
(PTY).
