mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 23:28:13 +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
|
||||
|
@ -21,7 +21,7 @@ sysinfo = "0.29"
|
||||
nix = { version = "0.27", default-features = false, features = ["fs", "term", "process", "signal"] }
|
||||
|
||||
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
|
||||
procfs = "0.15"
|
||||
procfs = "0.16"
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
libproc = "0.14"
|
||||
|
@ -1,6 +1,6 @@
|
||||
use log::info;
|
||||
use procfs::process::{FDInfo, Io, Process, Stat, Status};
|
||||
use procfs::{ProcError, ProcessCgroup};
|
||||
use procfs::{ProcError, ProcessCGroups, WithCurrentSystemInfo};
|
||||
use std::path::PathBuf;
|
||||
use std::thread;
|
||||
use std::time::{Duration, Instant};
|
||||
@ -25,7 +25,7 @@ impl ProcessTask {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cgroups(&self) -> Result<Vec<ProcessCgroup>, ProcError> {
|
||||
pub fn cgroups(&self) -> Result<ProcessCGroups, ProcError> {
|
||||
match self {
|
||||
ProcessTask::Process(x) => x.cgroups(),
|
||||
_ => Err(ProcError::Other("not supported".to_string())),
|
||||
@ -218,7 +218,7 @@ impl ProcessInfo {
|
||||
/// Memory size in number of bytes
|
||||
pub fn mem_size(&self) -> u64 {
|
||||
match self.curr_proc.stat() {
|
||||
Ok(p) => p.rss_bytes(),
|
||||
Ok(p) => p.rss_bytes().get(),
|
||||
Err(_) => 0,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user