Struct kube_client::api::AttachedProcess
source · pub struct AttachedProcess { /* private fields */ }
Available on crate features
client
and ws
only.Expand description
Represents an attached process in a container for attach
and exec
.
Provides access to stdin
, stdout
, and stderr
if attached.
Use AttachedProcess::join
to wait for the process to terminate.
Implementations§
source§impl AttachedProcess
impl AttachedProcess
sourcepub fn stdin(&mut self) -> Option<impl AsyncWrite + Unpin>
pub fn stdin(&mut self) -> Option<impl AsyncWrite + Unpin>
Async writer to stdin.
let mut stdin_writer = attached.stdin().unwrap();
stdin_writer.write(b"foo\n").await?;
Only available if AttachParams
had stdin
.
sourcepub fn stdout(&mut self) -> Option<impl AsyncRead + Unpin>
pub fn stdout(&mut self) -> Option<impl AsyncRead + Unpin>
Async reader for stdout outputs.
let mut stdout_reader = attached.stdout().unwrap();
let mut buf = [0u8; 4];
stdout_reader.read_exact(&mut buf).await?;
Only available if AttachParams
had stdout
.
sourcepub fn stderr(&mut self) -> Option<impl AsyncRead + Unpin>
pub fn stderr(&mut self) -> Option<impl AsyncRead + Unpin>
Async reader for stderr outputs.
let mut stderr_reader = attached.stderr().unwrap();
let mut buf = [0u8; 4];
stderr_reader.read_exact(&mut buf).await?;
Only available if AttachParams
had stderr
.
sourcepub fn take_status(&mut self) -> Option<impl Future<Output = Option<Status>>>
pub fn take_status(&mut self) -> Option<impl Future<Output = Option<Status>>>
Take a future that resolves with any status object or when the sender is dropped.
Returns None
if called more than once.
sourcepub fn terminal_size(&mut self) -> Option<Sender<TerminalSize>>
pub fn terminal_size(&mut self) -> Option<Sender<TerminalSize>>
Async writer to change the terminal size
let mut terminal_size_writer = attached.terminal_size().unwrap();
terminal_size_writer.send(TerminalSize{
height: 100,
width: 200,
}).await?;
Only available if AttachParams
had tty
.