We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d6fdc0b commit 3fbfad0Copy full SHA for 3fbfad0
src/lib.rs
@@ -57,7 +57,8 @@ impl SystemCtl {
57
args: S,
58
) -> std::io::Result<String> {
59
let mut child = self.spawn_child(args)?;
60
- match child.wait()?.code() {
+ let output = child.wait_with_output()?;
61
+ match output.status.code() {
62
Some(0) => {}, // success
63
Some(1) => {}, // success -> Ok(Unit not found)
64
Some(3) => {}, // success -> Ok(unit is inactive and/or dead)
@@ -83,8 +84,8 @@ impl SystemCtl {
83
84
},
85
}
86
- let mut stdout: Vec<u8> = Vec::new();
87
- let size = child.stdout.unwrap().read_to_end(&mut stdout)?;
+ let mut stdout: Vec<u8> = output.stdout;
88
+ let size = stdout.len();
89
90
if size > 0 {
91
if let Ok(s) = String::from_utf8(stdout) {
0 commit comments