diff --git a/Cargo.toml b/Cargo.toml index 5aaa2b5f..32a78882 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,8 @@ default = [ docs = ["attributes", "unstable", "default"] unstable = [ "std", - "async-io" + "async-io", + "async-process", ] attributes = ["async-attributes"] std = [ @@ -86,6 +87,7 @@ async-global-executor = { version = "1.4.0", optional = true, features = ["async async-io = { version = "1.0.1", optional = true } blocking = { version = "1.0.0", optional = true } futures-lite = { version = "1.0.0", optional = true } +async-process = { version = "1.0.1", optional = true } [target.'cfg(target_arch = "wasm32")'.dependencies] gloo-timers = { version = "0.2.1", features = ["futures"], optional = true } diff --git a/src/lib.rs b/src/lib.rs index e985f40d..22495d36 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -313,7 +313,7 @@ cfg_default! { cfg_unstable! { pub mod pin; - #[cfg(not(target_os = "unknown"))] + #[cfg(all(not(target_os = "unknown"), feature = "std"))] pub mod process; mod unit; diff --git a/src/os/unix/mod.rs b/src/os/unix/mod.rs index c389d95a..36a97967 100644 --- a/src/os/unix/mod.rs +++ b/src/os/unix/mod.rs @@ -8,3 +8,8 @@ cfg_default! { pub mod fs; pub mod net; } + +#[cfg(all(feature = "unstable", feature = "std"))] +#[cfg_attr(feature = "docs", doc(cfg(unstable)))] +#[doc(inline)] +pub use async_process::unix as process; diff --git a/src/os/windows/mod.rs b/src/os/windows/mod.rs index 67bf0372..0d45a52e 100644 --- a/src/os/windows/mod.rs +++ b/src/os/windows/mod.rs @@ -7,4 +7,7 @@ cfg_std! { cfg_unstable! { #[cfg(feature = "default")] pub mod fs; + #[cfg(feature = "std")] + #[cfg(windows)] + pub use async_process::windows as process; } diff --git a/src/process.rs b/src/process.rs new file mode 100644 index 00000000..09b8390e --- /dev/null +++ b/src/process.rs @@ -0,0 +1,40 @@ +//! A module for working with processes. +//! +//! This module is mostly concerned with spawning and interacting with child processes, but it also +//! provides abort and exit for terminating the current process. +//! +//! This is an async version of [`std::process`]. +//! +//! [`std::process`]: https://doc.rust-lang.org/std/process/index.html + +#[cfg_attr(feature = "docs", doc(cfg(unstable)))] +#[doc(inline)] +pub use async_process::ExitStatus; + +#[cfg_attr(feature = "docs", doc(cfg(unstable)))] +#[doc(inline)] +pub use async_process::Output; + +#[cfg_attr(feature = "docs", doc(cfg(unstable)))] +#[doc(inline)] +pub use async_process::Stdio; + +#[cfg_attr(feature = "docs", doc(cfg(unstable)))] +#[doc(inline)] +pub use async_process::Child; + +#[cfg_attr(feature = "docs", doc(cfg(unstable)))] +#[doc(inline)] +pub use async_process::ChildStderr; + +#[cfg_attr(feature = "docs", doc(cfg(unstable)))] +#[doc(inline)] +pub use async_process::ChildStdin; + +#[cfg_attr(feature = "docs", doc(cfg(unstable)))] +#[doc(inline)] +pub use async_process::ChildStdout; + +#[cfg_attr(feature = "docs", doc(cfg(unstable)))] +#[doc(inline)] +pub use async_process::Command; diff --git a/src/process/mod.rs b/src/process/mod.rs deleted file mode 100644 index 630c5b9b..00000000 --- a/src/process/mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -//! A module for working with processes. -//! -//! This module is mostly concerned with spawning and interacting with child processes, but it also -//! provides abort and exit for terminating the current process. -//! -//! This is an async version of [`std::process`]. -//! -//! [`std::process`]: https://doc.rust-lang.org/std/process/index.html - -// Re-export structs. -pub use std::process::{ExitStatus, Output}; - -// Re-export functions. -pub use std::process::{abort, exit, id};