pub struct ProcStat {
pub exit_code: i32,
pub stdout: String,
pub stderr: String,
}
Expand description
Stores process information: exit code, stdout, stderr.
Fields§
§exit_code: i32
§stdout: String
§stderr: String
Implementations§
Source§impl ProcStat
impl ProcStat
Sourcepub fn output(&self) -> String
pub fn output(&self) -> String
Returns a copy of the output.
Use it if you want to avoid value moving.
Sourcepub fn trimmed_output(&self) -> String
pub fn trimmed_output(&self) -> String
Trims the trailing whitespaces from the output.
Examples found in repository?
examples/process.rs (line 17)
3fn main() {
4 let commands = vec![
5 r#"python -c "print('Hello Py3!')""#,
6 "python --version",
7 "date",
8 ];
9
10 for cmd in commands.iter() {
11 let stat = jabba_lib::jprocess::get_exitcode_stdout_stderr(cmd).unwrap();
12 println!("{:?}", stat);
13 }
14
15 let date = jabba_lib::jprocess::get_exitcode_stdout_stderr("date")
16 .unwrap()
17 .trimmed_output();
18 println!("{:?}", date);
19
20 let cmd = "ls -al";
21 jproc::exec_cmd(cmd);
22}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ProcStat
impl RefUnwindSafe for ProcStat
impl Send for ProcStat
impl Sync for ProcStat
impl Unpin for ProcStat
impl UnwindSafe for ProcStat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more