| 1 | mod pidrust-analyzer cargo process_alive 0.2.0 pid/; |
| 2 | pub use selfrust-analyzer cargo process_alive 0.2.0 crate/::pidrust-analyzer cargo process_alive 0.2.0 pid/::*; |
| 3 | mod staterust-analyzer cargo process_alive 0.2.0 state/; |
| 4 | pub use selfrust-analyzer cargo process_alive 0.2.0 crate/::staterust-analyzer cargo process_alive 0.2.0 state/::*; |
| 5 | |
| 6 | #[cfg(unix)] |
| 7 | mod unixrust-analyzer cargo process_alive 0.2.0 unix/; |
| 8 | #[cfg(unix)] |
| 9 | pub use selfrust-analyzer cargo process_alive 0.2.0 crate/::unixrust-analyzer cargo process_alive 0.2.0 unix/::*; |
| 10 | |
| 11 | #[cfg(windows)] |
| 12 | mod windows; |
| 13 | #[cfg(windows)] |
| 14 | pub use selfrust-analyzer cargo process_alive 0.2.0 crate/::windows::*; |
| 15 | |
| 16 | #[cfg(test)] |
| 17 | mod testsrust-analyzer cargo process_alive 0.2.0 tests/ { |
| 18 | use superrust-analyzer cargo process_alive 0.2.0 crate/::*; |
| 19 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::processrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/::Commandrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/Command#; |
| 20 | |
| 21 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 22 | fn test_aliverust-analyzer cargo process_alive 0.2.0 tests/test_alive().() { |
| 23 | let mut child = Commandrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/Command#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]new().("sleep").argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("5").spawnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]spawn().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 24 | let pid = child.idrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Child]id().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 25 | let state = staterust-analyzer cargo process_alive 0.2.0 unix/state().(pid); |
| 26 | child.killrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Child]kill().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 27 | child.waitrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Child]wait().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 28 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Staterust-analyzer cargo process_alive 0.2.0 state/State#::Aliverust-analyzer cargo process_alive 0.2.0 state/State#Alive#, state); |
| 29 | } |
| 30 | |
| 31 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 32 | fn test_deadrust-analyzer cargo process_alive 0.2.0 tests/test_dead().() { |
| 33 | let mut child = Commandrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/Command#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]new().("sleep").argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("5").spawnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]spawn().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 34 | let pid = child.idrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Child]id().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 35 | child.killrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Child]kill().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 36 | child.waitrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Child]wait().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 37 | let state = staterust-analyzer cargo process_alive 0.2.0 unix/state().(pid); |
| 38 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Staterust-analyzer cargo process_alive 0.2.0 state/State#::Deadrust-analyzer cargo process_alive 0.2.0 state/State#Dead#, state); |
| 39 | } |
| 40 | } |