From 0c77cd47f7ac4c66dca56f3fa830b72b7b272417 Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Tue, 17 May 2022 12:04:35 +0100 Subject: [PATCH] file argument binding --- src/spawner/mod.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/spawner/mod.rs b/src/spawner/mod.rs index 3fe3d18..06880c5 100644 --- a/src/spawner/mod.rs +++ b/src/spawner/mod.rs @@ -4,7 +4,7 @@ mod args; use args::PreparedArgs; -use crate::specification::{Entrypoint, Environment, Specification, Trigger}; +use crate::specification::{Arg, Entrypoint, Environment, Specification, Trigger}; use crate::void::VoidBuilder; use crate::{Error, Result}; use crate::{PipePair, SocketPair}; @@ -100,7 +100,7 @@ impl<'a> Spawner<'a> { Trigger::Pipe(s) => { let mut builder = VoidBuilder::new(); self.mount_entrypoint(&mut builder, self.binary)?; - self.forward_mounts(&mut builder, &entrypoint.environment); + self.forward_mounts(&mut builder, &entrypoint.environment, &entrypoint.args); let pipe = self.pipes.get_mut(s).unwrap().take_read()?; builder.keep_fd(&pipe); @@ -124,7 +124,7 @@ impl<'a> Spawner<'a> { Trigger::FileSocket(s) => { let mut builder = VoidBuilder::new(); self.mount_entrypoint(&mut builder, self.binary)?; - self.forward_mounts(&mut builder, &entrypoint.environment); + self.forward_mounts(&mut builder, &entrypoint.environment, &entrypoint.args); let socket = self.sockets.get_mut(s).unwrap().take_read()?; builder.keep_fd(&socket); @@ -288,6 +288,7 @@ impl<'a> Spawner<'a> { &self, builder: &mut VoidBuilder, environment: impl IntoIterator, + arguments: impl IntoIterator, ) { for env in environment { if let Environment::Filesystem { @@ -298,6 +299,12 @@ impl<'a> Spawner<'a> { builder.mount(host_path, host_path); } } + + for arg in arguments { + if let Arg::File(host_path) = arg { + builder.mount(host_path, host_path); + } + } } fn prepare_env<'b>( -- 2.47.0