|
0 |
diff --git a/src/lib.rs b/src/lib.rs
|
|
1 |
index 5c4f200..73f5ddb 100644
|
|
2 |
--- a/src/lib.rs
|
|
3 |
+++ b/src/lib.rs
|
|
4 |
@@ -29,37 +29,6 @@
|
|
5 |
//! workaround using `waitpid` for these platforms as we run into them. Please
|
|
6 |
//! [file an issue](https://github.com/oconnor663/shared_child.rs/issues/new) if
|
|
7 |
//! you hit this.
|
|
8 |
-//!
|
|
9 |
-//! # Example
|
|
10 |
-//!
|
|
11 |
-//! ```rust
|
|
12 |
-//! use shared_child::SharedChild;
|
|
13 |
-//! use std::process::Command;
|
|
14 |
-//! use std::sync::Arc;
|
|
15 |
-//!
|
|
16 |
-//! // Spawn a child that will just sleep for a long time,
|
|
17 |
-//! // and put it in an Arc to share between threads.
|
|
18 |
-//! let mut command = Command::new("python");
|
|
19 |
-//! command.arg("-c").arg("import time; time.sleep(1000000000)");
|
|
20 |
-//! let shared_child = SharedChild::spawn(&mut command).unwrap();
|
|
21 |
-//! let child_arc = Arc::new(shared_child);
|
|
22 |
-//!
|
|
23 |
-//! // On another thread, wait on the child process.
|
|
24 |
-//! let child_arc_clone = child_arc.clone();
|
|
25 |
-//! let thread = std::thread::spawn(move || {
|
|
26 |
-//! child_arc_clone.wait().unwrap()
|
|
27 |
-//! });
|
|
28 |
-//!
|
|
29 |
-//! // While the other thread is waiting, kill the child process.
|
|
30 |
-//! // This wouldn't be possible with e.g. Arc<Mutex<Child>> from
|
|
31 |
-//! // the standard library, because the waiting thread would be
|
|
32 |
-//! // holding the mutex.
|
|
33 |
-//! child_arc.kill().unwrap();
|
|
34 |
-//!
|
|
35 |
-//! // Join the waiting thread and get the exit status.
|
|
36 |
-//! let exit_status = thread.join().unwrap();
|
|
37 |
-//! assert!(!exit_status.success());
|
|
38 |
-//! ```
|
|
39 |
|
|
40 |
use std::io;
|
|
41 |
use std::process::{Child, ChildStderr, ChildStdin, ChildStdout, Command, ExitStatus};
|