Revert "Rewrite the ps command"

This commit is contained in:
Jonathan Turner
2019-08-11 13:41:21 +12:00
committed by GitHub
parent 2fe7f76219
commit e19c618ac5
8 changed files with 70 additions and 75 deletions

17
src/commands/ps.rs Normal file
View File

@@ -0,0 +1,17 @@
use crate::errors::ShellError;
use crate::object::process::process_dict;
use crate::prelude::*;
use sysinfo::{RefreshKind, SystemExt};
pub fn ps(args: CommandArgs, _registry: &CommandRegistry) -> Result<OutputStream, ShellError> {
let mut system = sysinfo::System::new_with_specifics(RefreshKind::new().with_processes());
system.refresh_processes();
let list = system.get_process_list();
let list = list
.into_iter()
.map(|(_, process)| process_dict(process, Tag::unknown_origin(args.call_info.name_span)))
.collect::<VecDeque<_>>();
Ok(list.from_input_stream())
}