mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 07:00:37 +02:00
Seems ps still needs a delay to be accurate (#484)
This commit is contained in:
@ -23,7 +23,7 @@ csv = "1.1.3"
|
||||
glob = "0.3.0"
|
||||
Inflector = "0.11"
|
||||
thiserror = "1.0.29"
|
||||
sysinfo = "0.20.4"
|
||||
sysinfo = "0.21.2"
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
chrono-humanize = "0.2.1"
|
||||
chrono-tz = "0.6.0"
|
||||
|
@ -54,11 +54,15 @@ fn run_ps(engine_state: &EngineState, call: &Call) -> Result<PipelineData, Shell
|
||||
let mut sys = System::new_all();
|
||||
sys.refresh_all();
|
||||
|
||||
let duration = std::time::Duration::from_millis(500);
|
||||
std::thread::sleep(duration);
|
||||
|
||||
let mut output = vec![];
|
||||
|
||||
let result: Vec<_> = sys.processes().iter().map(|x| *x.0).collect();
|
||||
|
||||
for pid in result {
|
||||
sys.refresh_process(pid);
|
||||
if let Some(result) = sys.process(pid) {
|
||||
let mut cols = vec![];
|
||||
let mut vals = vec![];
|
||||
|
Reference in New Issue
Block a user