Skip to content

Commit a19519e

Browse files
committed
feat(api): add &mut Command to pre_spawn()
This addition makes it possible to mutate the `Command` in `pre_spawn()`, spawn a `Child` from that mutated command, then roll-back the changes to command in `post_spawn()`.
1 parent 1fc90cb commit a19519e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/generic_wrap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ macro_rules! Wrap {
9191
for (id, wrapper) in wrappers.iter_mut() {
9292
#[cfg(feature = "tracing")]
9393
::tracing::debug!(?id, "post_spawn");
94-
wrapper.post_spawn(&mut child, self)?;
94+
wrapper.post_spawn(command, &mut child, self)?;
9595
}
9696

9797
let mut child = Box::new(
@@ -204,7 +204,7 @@ macro_rules! Wrap {
204204
/// how `CreationFlags` on Windows works along with `JobObject`.
205205
///
206206
/// Default: no-op.
207-
fn post_spawn(&mut self, _child: &mut $child, _core: &$name) -> Result<()> {
207+
fn post_spawn(&mut self, _command: &mut $command, _child: &mut $child, _core: &$name) -> Result<()> {
208208
Ok(())
209209
}
210210

0 commit comments

Comments
 (0)