Skip to content

Commit c689253

Browse files
committed
Add comment in Command::spawn
Signed-off-by: Jiahao XU <[email protected]>
1 parent 6d1d1ff commit c689253

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/native_mux_impl/command.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ impl Command {
8181
.into_iter()
8282
.zip(is_inherited)
8383
.filter_map(|(stdio, is_inherited)| if !is_inherited { Some(stdio) } else { None })
84+
// Note that once we do this, these file descriptors
85+
// (and the Fds we got them from above) should no longer be used in
86+
// any async context, as they'd start blocking.
87+
//
88+
// We give away the descriptors in stdios when we pass them to
89+
// open_new_session (which doesn't use them in an async context),
90+
// and the Fds are dropped when this function returns, meaning no
91+
// owned file descriptors we set to be blocking here can be used in
92+
// an async context in the future.
8493
.try_for_each(|stdio| set_blocking(stdio).map_err(Error::ChildIo))?;
8594

8695
let cmd = NonZeroByteSlice::new(&self.cmd).ok_or(Error::InvalidCommand)?;

0 commit comments

Comments
 (0)