chiark / gitweb /
apitest: Pass ds into OtterArgsSpec
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 21 May 2021 19:11:33 +0000 (20:11 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 21 May 2021 19:11:33 +0000 (20:11 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
apitest/apitest.rs
apitest/main.rs

index dea84a0888bfab58fe5cbc105666f028a5656fab..9d1151de313c255272852761948b39a68de7c58b 100644 (file)
@@ -742,16 +742,18 @@ impl Drop for OtterOutput {
 }
 
 pub trait OtterArgsSpec {
-  fn to_args(&self) -> Vec<String>;
+  fn to_args(&self, ds: &DirSubst) -> Vec<String>;
 }
 
 impl<S> OtterArgsSpec for [S] where for <'s> &'s S: Into<String> {
-  fn to_args(&self) -> Vec<String> {
+  fn to_args(&self, _: &DirSubst) -> Vec<String> {
     self.iter().map(|s| s.into()).collect()
   }
 }
 impl<S> OtterArgsSpec for Vec<S> where for <'s> &'s S: Into<String> {
-  fn to_args(&self) -> Vec<String> { self.as_slice().to_args() }
+  fn to_args(&self, ds: &DirSubst) -> Vec<String> {
+    self.as_slice().to_args(ds)
+  }
 }
 
 impl DirSubst {
@@ -780,7 +782,7 @@ impl DirSubst {
     let mut args: Vec<String> = vec![];
     args.push("--config"  .to_owned()); args.push(prctx.resolve(&CONFIG));
     args.push("--spec-dir".to_owned()); args.push(prctx.resolve(&specs) );
-    args.extend(xargs.to_args());
+    args.extend(xargs.to_args(ds));
     let dbg = format!("running {} {:?}", &exe, &args);
     let mut output = NamedTempFile::new_in(
       ds.subst("@abstmp@").unwrap()
index 6c8dd0ddb70879500187e4f3bafc56d473000e3b..38d4035b4a081f2d3dc47838b38a67594103fa60 100644 (file)
@@ -490,7 +490,7 @@ impl UsualCtx {
   pub fn otter(&mut self, args: &dyn OtterArgsSpec) -> OtterOutput {
     let args: Vec<String> =
       ["--account", "server:"].iter().cloned().map(Into::into)
-      .chain(args.to_args().into_iter())
+      .chain(args.to_args(&self.su().ds).into_iter())
       .collect();
     self.su().ds.otter_prctx(&self.prctx, &args)?
   }