pub struct Shell<'a, T: Utf8Encoding> { /* private fields */ }Expand description
A stateful shell abstraction for interacting with the guest.
This is modeled after xshell::Shell.
Implementations§
Source§impl<T> Shell<'_, T>where
T: Utf8Encoding,
impl<T> Shell<'_, T>where
T: Utf8Encoding,
Sourcepub fn change_dir(&mut self, path: impl AsRef<Utf8Path<T>>)
pub fn change_dir(&mut self, path: impl AsRef<Utf8Path<T>>)
Change the effective working directory of the shell.
Other paths will be resolved relative to this directory.
Sourcepub fn chroot(&mut self, root: impl Into<String>)
pub fn chroot(&mut self, root: impl Into<String>)
Set the chroot directory for commands run by this shell.
Each spawned process will chroot into this directory before exec (Linux only). The shell itself is unaffected.
Sourcepub async fn read_file(&self, path: impl AsRef<Utf8Path<T>>) -> Result<String>
pub async fn read_file(&self, path: impl AsRef<Utf8Path<T>>) -> Result<String>
Reads a file from the guest into a string.
Auto Trait Implementations§
impl<'a, T> Freeze for Shell<'a, T>
impl<'a, T> !RefUnwindSafe for Shell<'a, T>
impl<'a, T> Send for Shell<'a, T>where
T: Send,
impl<'a, T> Sync for Shell<'a, T>where
T: Sync,
impl<'a, T> Unpin for Shell<'a, T>where
T: Unpin,
impl<'a, T> !UnwindSafe for Shell<'a, T>
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