mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 16:33:37 +01:00
Seems ps still needs a delay to be accurate (#484)
This commit is contained in:
parent
2013e9300a
commit
1336acd34a
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -2896,9 +2896,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sysinfo"
|
||||
version = "0.20.5"
|
||||
version = "0.21.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e223c65cd36b485a34c2ce6e38efa40777d31c4166d9076030c74cdcf971679f"
|
||||
checksum = "8f88d66f3341b688163d3585037954ff276cf24a234d015b30025318a3e3449a"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"core-foundation-sys",
|
||||
|
@ -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![];
|
||||
|
Loading…
Reference in New Issue
Block a user