MCPcopy Create free account
hub / github.com/bootc-dev/bootc / read

Method read

crates/lib/src/task.rs:165–182  ·  view source on GitHub ↗

Like [`Task::run`], but return stdout.

(self)

Source from the content-addressed store, hash-verified

163
164 /// Like [`Task::run`], but return stdout.
165 pub(crate) fn read(self) -> Result<String> {
166 self.pre_run_output();
167 let description = self.description;
168 let mut cmd = self.cmd;
169 tracing::debug!("exec: {cmd:?}");
170 cmd.stdout(Stdio::piped());
171 let child = cmd
172 .spawn()
173 .with_context(|| format!("Spawning {description} failed"))?;
174 let o = child
175 .wait_with_output()
176 .with_context(|| format!("Executing {description} failed"))?;
177 let st = o.status;
178 if !st.success() {
179 anyhow::bail!("Task {description} failed: {st:?}");
180 }
181 Ok(String::from_utf8(o.stdout)?)
182 }
183
184 pub(crate) fn new_and_run<'a>(
185 description: impl AsRef<str>,

Callers 15

files_eqFunction · 0.45
read_uefi_varFunction · 0.45
ensure_dir_labeledFunction · 0.45
write_grub_uki_menuentryFunction · 0.45
test_bootc_statusFunction · 0.45
run_alongsideFunction · 0.45
image_digestFunction · 0.45
builder_from_imageFunction · 0.45

Calls 1

pre_run_outputMethod · 0.80

Tested by 5

test_bootc_statusFunction · 0.36