mirror of
https://github.com/nushell/nushell
synced 2024-12-27 21:43:09 +00:00
commit
9c61d6d590
1 changed files with 16 additions and 2 deletions
|
@ -2,7 +2,8 @@ use crate::commands::WholeStreamCommand;
|
|||
use crate::errors::ShellError;
|
||||
use crate::object::process::process_dict;
|
||||
use crate::prelude::*;
|
||||
use sysinfo::SystemExt;
|
||||
#[allow(unused)]
|
||||
use sysinfo::{RefreshKind, SystemExt};
|
||||
|
||||
pub struct PS;
|
||||
|
||||
|
@ -25,7 +26,20 @@ impl WholeStreamCommand for PS {
|
|||
}
|
||||
|
||||
fn ps(args: CommandArgs, _registry: &CommandRegistry) -> Result<OutputStream, ShellError> {
|
||||
let system = sysinfo::System::new();
|
||||
let system;
|
||||
|
||||
#[cfg(linux)]
|
||||
{
|
||||
system = sysinfo::System::new();
|
||||
}
|
||||
|
||||
#[cfg(not(linux))]
|
||||
{
|
||||
let mut sy = sysinfo::System::new_with_specifics(RefreshKind::new().with_processes());
|
||||
sy.refresh_processes();
|
||||
|
||||
system = sy;
|
||||
}
|
||||
let list = system.get_process_list();
|
||||
|
||||
let list = list
|
||||
|
|
Loading…
Reference in a new issue