diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index fc768809f02..cf1952ac189 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -751,29 +751,34 @@ impl Command { /// /// Process groups determine which processes receive signals. /// - /// **Note**: This is an [unstable API][unstable] but will be stabilised once - /// tokio's `MSRV` is sufficiently new. See [the documentation on - /// unstable features][unstable] for details about using unstable features. + /// # Examples + /// + /// Pressing Ctrl-C in a terminal will send `SIGINT` to all processes + /// in the current foreground process group. By spawning the `sleep` + /// subprocess in a new process group, it will not receive `SIGINT` + /// from the terminal. /// - /// If you want similar behavior without using this unstable feature you can - /// create a [`std::process::Command`] and convert that into a - /// [`tokio::process::Command`] using the `From` trait. + /// The parent process could install a [signal handler] and manage the + /// process on its own terms. /// - /// [unstable]: crate#unstable-features - /// [`tokio::process::Command`]: crate::process::Command + /// A process group ID of 0 will use the process ID as the PGID. /// /// ```no_run /// # async fn test() { // allow using await /// use tokio::process::Command; /// - /// let output = Command::new("ls") - /// .process_group(0) - /// .output().await.unwrap(); + /// let output = Command::new("sleep") + /// .arg("10") + /// .process_group(0) + /// .output() + /// .await + /// .unwrap(); /// # } /// ``` + /// + /// [signal handler]: crate::signal #[cfg(unix)] - #[cfg(tokio_unstable)] - #[cfg_attr(docsrs, doc(cfg(all(unix, tokio_unstable))))] + #[cfg_attr(docsrs, doc(cfg(unix)))] pub fn process_group(&mut self, pgroup: i32) -> &mut Command { self.std.process_group(pgroup); self