mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Bump procfs
to 0.16.0 (#11115)
Fix the breaking changes. Get's rid of some outdated transitive dependencies. Sadly we need to expose more of `procfs` to `nu-command` based on how the features of `nu-system` are exposed right now. Conditional compilation/dependencies from hell included Supersedes #11101
This commit is contained in:
committed by
GitHub
parent
869b01205c
commit
8ad5d8bb6a
@ -106,6 +106,9 @@ libc = "0.2"
|
||||
umask = "2.1"
|
||||
nix = { version = "0.27", default-features = false, features = ["user"] }
|
||||
|
||||
[target.'cfg(all(unix, not(target_os = "macos"), not(target_os = "android"), not(target_os = "ios")))'.dependencies]
|
||||
procfs = "0.16.0"
|
||||
|
||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies.trash]
|
||||
optional = true
|
||||
version = "3.1"
|
||||
|
@ -14,6 +14,14 @@ use nu_protocol::{
|
||||
Category, Example, IntoInterruptiblePipelineData, PipelineData, Record, ShellError, Signature,
|
||||
Type, Value,
|
||||
};
|
||||
#[cfg(all(
|
||||
unix,
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "windows"),
|
||||
not(target_os = "android"),
|
||||
not(target_os = "ios")
|
||||
))]
|
||||
use procfs::WithCurrentSystemInfo;
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
@ -127,13 +135,11 @@ fn run_ps(engine_state: &EngineState, call: &Call) -> Result<PipelineData, Shell
|
||||
Vec::new(),
|
||||
)
|
||||
})?;
|
||||
let proc_start = match proc_stat.starttime() {
|
||||
Ok(t) => t,
|
||||
Err(_) => {
|
||||
// If we can't get the start time, just use the current time
|
||||
chrono::Local::now()
|
||||
}
|
||||
};
|
||||
// If we can't get the start time, just use the current time
|
||||
let proc_start = proc_stat
|
||||
.starttime()
|
||||
.get()
|
||||
.unwrap_or_else(|_| chrono::Local::now());
|
||||
record.push("start_time", Value::date(proc_start.into(), span));
|
||||
record.push("user_id", Value::int(proc.curr_proc.owner() as i64, span));
|
||||
// These work and may be helpful, but it just seemed crowded
|
||||
|
Reference in New Issue
Block a user