| 1 |
Description: use newer minor version of crate sysinfo |
| 2 |
Author: Jonas Smedegaard <[email protected]> |
| 3 |
Last-Update: 2026-08-02 |
| 4 |
--- |
| 5 |
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ |
| 6 |
--- a/Cargo.toml |
| 7 |
+++ b/Cargo.toml |
| 8 |
@@ -52,7 +52,7 @@ |
| 9 |
smol_str = ">= 0.1.24, <= 0.3" |
| 10 |
syntect = "5.0.0" |
| 11 |
# sysinfo: no default features to disable the use of threads |
| 12 |
|
| 13 |
+sysinfo = { version = "0.39.3", default-features = false, features = ["system"] } |
| 14 |
terminal-colorsaurus = "0.4.8" |
| 15 |
unicode-segmentation = "1.10.1" |
| 16 |
# 0.2.0 (and 0.1.13) treats \n as width 1. Lines processed by delta have, lose, |
| 17 |
--- a/src/utils/process.rs |
| 18 |
+++ b/src/utils/process.rs |
| 19 |
@@ -4,7 +4,7 @@ |
| 20 |
use std::sync::{Arc, Condvar, Mutex, MutexGuard}; |
| 21 |
|
| 22 |
use lazy_static::lazy_static; |
| 23 |
|
| 24 |
+use sysinfo::{Pid, Process, ProcessRefreshKind, ProcessesToUpdate, UpdateKind}; |
| 25 |
|
| 26 |
use crate::utils::DELTA_ATOMIC_ORDERING; |
| 27 |
|
| 28 |
@@ -279,27 +279,27 @@ |
| 29 |
} |
| 30 |
|
| 31 |
trait ProcActions { |
| 32 |
|
| 33 |
+ fn cmd(&self) -> Vec<String>; |
| 34 |
fn parent(&self) -> Option<DeltaPid>; |
| 35 |
fn pid(&self) -> DeltaPid; |
| 36 |
fn start_time(&self) -> u64; |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
+impl ProcActions for Process { |
| 46 |
+ fn cmd(&self) -> Vec<String> { |
| 47 |
+ Process::cmd(self) |
| 48 |
+ .iter() |
| 49 |
+ .map(|arg| arg.to_string_lossy().into_owned()) |
| 50 |
+ .collect() |
| 51 |
} |
| 52 |
fn parent(&self) -> Option<DeltaPid> { |
| 53 |
|
| 54 |
+ Process::parent(self).map(|p| p.as_u32()) |
| 55 |
} |
| 56 |
fn pid(&self) -> DeltaPid { |
| 57 |
|
| 58 |
+ Process::pid(self).as_u32() |
| 59 |
} |
| 60 |
fn start_time(&self) -> u64 { |
| 61 |
|
| 62 |
+ Process::start_time(self) |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
@@ -369,7 +369,7 @@ |
| 67 |
.filter(|(_, proc)| { |
| 68 |
process_start_time_difference_less_than_3s(this_start_time, proc.start_time()) |
| 69 |
}) |
| 70 |
|
| 71 |
+ .filter_map(|(&pid, proc)| match extract_args(&proc.cmd()) { |
| 72 |
ProcessArgs::Args(args) => { |
| 73 |
let mut length_of_process_chain = usize::MAX; |
| 74 |
|
| 75 |
@@ -405,8 +405,11 @@ |
| 76 |
std::process::id() |
| 77 |
} |
| 78 |
fn refresh_process(&mut self, pid: DeltaPid) -> bool { |
| 79 |
|
| 80 |
|
| 81 |
+ self.info.refresh_processes_specifics( |
| 82 |
+ ProcessesToUpdate::Some(&[Pid::from_u32(pid)]), |
| 83 |
+ true, |
| 84 |
+ ProcessRefreshKind::nothing().with_cmd(UpdateKind::Always), |
| 85 |
+ ) > 0 |
| 86 |
} |
| 87 |
fn process(&self, pid: DeltaPid) -> Option<&Self::Out> { |
| 88 |
self.info.process(Pid::from_u32(pid)) |
| 89 |
@@ -415,8 +418,11 @@ |
| 90 |
self.info.processes() |
| 91 |
} |
| 92 |
fn refresh_processes(&mut self) { |
| 93 |
|
| 94 |
|
| 95 |
+ self.info.refresh_processes_specifics( |
| 96 |
+ ProcessesToUpdate::All, |
| 97 |
+ true, |
| 98 |
+ ProcessRefreshKind::nothing().with_cmd(UpdateKind::Always), |
| 99 |
+ ); |
| 100 |
} |
| 101 |
} |
| 102 |
|
| 103 |
@@ -449,7 +455,7 @@ |
| 104 |
}; |
| 105 |
let parent_pid = parent.pid(); |
| 106 |
|
| 107 |
|
| 108 |
+ match extract_args(&parent.cmd()) { |
| 109 |
ProcessArgs::Args(result) => return Some(result), |
| 110 |
ProcessArgs::ArgError => return None, |
| 111 |
|
| 112 |
@@ -459,7 +465,7 @@ |
| 113 |
ProcessArgs::OtherProcess if depth == 1 => { |
| 114 |
let sibling = info.naive_sibling_process(current_pid); |
| 115 |
if let Some(proc) = sibling { |
| 116 |
|
| 117 |
+ if let ProcessArgs::Args(result) = extract_args(&proc.cmd()) { |
| 118 |
return Some(result); |
| 119 |
} |
| 120 |
} |
| 121 |
@@ -700,8 +706,8 @@ |
| 122 |
} |
| 123 |
|
| 124 |
impl ProcActions for FakeProc { |
| 125 |
|
| 126 |
|
| 127 |
+ fn cmd(&self) -> Vec<String> { |
| 128 |
+ self.cmd.clone() |
| 129 |
} |
| 130 |
fn parent(&self) -> Option<DeltaPid> { |
| 131 |
self.ppid |