pub struct ShellSource {
pub contents: Vec<u8>,
}Expand description
Generate a shell script to execute via ShellScript.
This script is generated by writing Self::contents to a temporary
file. ```
§tokio_test::block_on(async {
use super_process::{sh, exe, base::CommandBase, sync::SyncInvocable};
let contents = “echo hey”.as_bytes().to_vec(); let source = sh::ShellSource { contents }; let script = source.into_script().await.expect(“generating shell script failed”); let command = script.with_command(exe::Command::default()) .setup_command().await.unwrap();
let output = command.invoke().await.expect(“shell script should succeed”); assert!(b“hey\n“.as_ref() == &output.stdout);
§}) // async
Fields§
§contents: Vec<u8>The bytes of a shell script to be written to file.
Implementations§
Source§impl ShellSource
impl ShellSource
Sourcepub async fn into_script(self) -> Result<ShellScript, ShellError>
pub async fn into_script(self) -> Result<ShellScript, ShellError>
Create a handle to a shell script backed by a temp file.
FIXME: we don’t ever delete the temp file! Use lifetimes to avoid this!
Trait Implementations§
Source§impl Clone for ShellSource
impl Clone for ShellSource
Source§fn clone(&self) -> ShellSource
fn clone(&self) -> ShellSource
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more