Struct libcnb_data::launch::ProcessBuilder
source · [−]pub struct ProcessBuilder { /* private fields */ }Implementations
sourceimpl ProcessBuilder
impl ProcessBuilder
A non-consuming builder for Process values.
Examples
ProcessBuilder::new(process_type!("web"), "java")
.arg("-jar")
.arg("target/application-1.0.0.jar")
.default(true)
.build();sourcepub fn new(type: ProcessType, command: impl Into<String>) -> Self
pub fn new(type: ProcessType, command: impl Into<String>) -> Self
Constructs a new ProcessBuilder with the following defaults:
- No arguments to the process
directisfalsedefaultisfalse
sourcepub fn arg(&mut self, arg: impl Into<String>) -> &mut Self
pub fn arg(&mut self, arg: impl Into<String>) -> &mut Self
Adds an argument to the process.
Only one argument can be passed per use. So instead of:
.arg("-C /path/to/repo")usage would be:
.arg("-C")
.arg("/path/to/repo")To pass multiple arguments see args.
sourcepub fn args(
&mut self,
args: impl IntoIterator<Item = impl Into<String>>
) -> &mut Self
pub fn args(
&mut self,
args: impl IntoIterator<Item = impl Into<String>>
) -> &mut Self
Adds multiple arguments to pass to the process.
To pass a single argument see arg.
sourcepub fn direct(&mut self, value: bool) -> &mut Self
pub fn direct(&mut self, value: bool) -> &mut Self
Sets the direct flag on the process.
If this is true, the lifecycle will launch the command directly, rather than via a shell.
Auto Trait Implementations
impl RefUnwindSafe for ProcessBuilder
impl Send for ProcessBuilder
impl Sync for ProcessBuilder
impl Unpin for ProcessBuilder
impl UnwindSafe for ProcessBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more