Skip to content

Commit 9cd0578

Browse files
authored
Merge pull request #916 from async-rs/async-process
feat: add process module
2 parents 415d0d1 + f8f1eac commit 9cd0578

File tree

6 files changed

+52
-16
lines changed

6 files changed

+52
-16
lines changed

Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ default = [
3737
docs = ["attributes", "unstable", "default"]
3838
unstable = [
3939
"std",
40-
"async-io"
40+
"async-io",
41+
"async-process",
4142
]
4243
attributes = ["async-attributes"]
4344
std = [
@@ -86,6 +87,7 @@ async-global-executor = { version = "1.4.0", optional = true, features = ["async
8687
async-io = { version = "1.0.1", optional = true }
8788
blocking = { version = "1.0.0", optional = true }
8889
futures-lite = { version = "1.0.0", optional = true }
90+
async-process = { version = "1.0.1", optional = true }
8991

9092
[target.'cfg(target_arch = "wasm32")'.dependencies]
9193
gloo-timers = { version = "0.2.1", features = ["futures"], optional = true }

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ cfg_default! {
313313

314314
cfg_unstable! {
315315
pub mod pin;
316-
#[cfg(not(target_os = "unknown"))]
316+
#[cfg(all(not(target_os = "unknown"), feature = "std"))]
317317
pub mod process;
318318

319319
mod unit;

src/os/unix/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ cfg_default! {
88
pub mod fs;
99
pub mod net;
1010
}
11+
12+
#[cfg(all(feature = "unstable", feature = "std"))]
13+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
14+
#[doc(inline)]
15+
pub use async_process::unix as process;

src/os/windows/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ cfg_std! {
77
cfg_unstable! {
88
#[cfg(feature = "default")]
99
pub mod fs;
10+
#[cfg(feature = "std")]
11+
#[cfg(windows)]
12+
pub use async_process::windows as process;
1013
}

src/process.rs

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//! A module for working with processes.
2+
//!
3+
//! This module is mostly concerned with spawning and interacting with child processes, but it also
4+
//! provides abort and exit for terminating the current process.
5+
//!
6+
//! This is an async version of [`std::process`].
7+
//!
8+
//! [`std::process`]: https://doc.rust-lang.org/std/process/index.html
9+
10+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
11+
#[doc(inline)]
12+
pub use async_process::ExitStatus;
13+
14+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
15+
#[doc(inline)]
16+
pub use async_process::Output;
17+
18+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
19+
#[doc(inline)]
20+
pub use async_process::Stdio;
21+
22+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
23+
#[doc(inline)]
24+
pub use async_process::Child;
25+
26+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
27+
#[doc(inline)]
28+
pub use async_process::ChildStderr;
29+
30+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
31+
#[doc(inline)]
32+
pub use async_process::ChildStdin;
33+
34+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
35+
#[doc(inline)]
36+
pub use async_process::ChildStdout;
37+
38+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
39+
#[doc(inline)]
40+
pub use async_process::Command;

src/process/mod.rs

-14
This file was deleted.

0 commit comments

Comments
 (0)