chiark / gitweb /
apitest: Capture and return the output from otter(1) in at-*
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 3 May 2021 12:41:18 +0000 (13:41 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 3 May 2021 12:41:18 +0000 (13:41 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
apitest/apitest.rs
apitest/at-otter.rs

index 421ce708d170af19e081fd2346b6acce8f5844b5..09bbca593ce179ed186c7f6b50ca57f1e9c7f079 100644 (file)
@@ -632,6 +632,7 @@ _ = "error" # rocket
 #[error("wait status: {0}")]
 pub struct ExitStatusError(pub std::process::ExitStatus);
 
+#[derive(Debug)]
 pub struct OtterOutput {
   output: Option<NamedTempFile>,
 }
index aa4afc3e6fdbf7c66cda209291a0770a7c671ff5..c273ec57bcd53ed907d21b2bacafeb18c1bcf628 100644 (file)
@@ -484,12 +484,12 @@ pub use GrabHow as GH;
 
 impl Ctx {
   #[throws(AE)]
-  pub fn otter<S:AsRef<str>>(&mut self, args: &[S]) {
+  pub fn otter<S:AsRef<str>>(&mut self, args: &[S]) -> OtterOutput {
     let args: Vec<String> =
       ["--account", "server:"].iter().cloned().map(Into::into)
       .chain(args.iter().map(|s| s.as_ref().to_owned()))
       .collect();
-    self.su().ds.otter_prctx(&self.prctx, &args)?;
+    self.su().ds.otter_prctx(&self.prctx, &args)?
   }
 
   #[throws(AE)]