created_at
stringlengths
20
20
test_patch
stringlengths
226
26.3k
issue_numbers
listlengths
1
1
instance_id
stringlengths
26
28
repo
stringclasses
1 value
patch
stringlengths
441
162k
base_commit
stringlengths
40
40
problem_statement
stringlengths
24
3.57k
version
stringlengths
3
4
pull_number
int64
51
1.41k
hints_text
stringlengths
0
9.55k
environment_setup_commit
stringlengths
40
40
2021-01-05T21:40:46Z
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -57,7 +57,7 @@ jobs: - { os: 'ubuntu-latest', target: 'arm-unknown-linux-gnueabihf', cross: true } - { os: 'ubuntu-latest', target: 'arm-unknown-linux-musleabihf', cro...
[ "187" ]
GuillaumeGomez__sysinfo-385
GuillaumeGomez/sysinfo
diff --git a/src/linux/system.rs b/src/linux/system.rs --- a/src/linux/system.rs +++ b/src/linux/system.rs @@ -503,6 +503,14 @@ impl SystemExt for System { fn get_users(&self) -> &[User] { &self.users } + + fn get_name(&self) -> Option<String> { + get_system_info("NAME=") + } + + fn g...
5341d2e5229a5d81a6acf1bb1f0d43bb15d8e48c
Add system version and/or OS name
0.15
385
The [`whoami` crate](https://crates.io/crates/whoami) has been really useful for this. It offers: * `whoami::platform()` - a serialisable enum for platform, such as `Linux`, `MacOS`, `Windows `, etc * `whoami::os()` - a string representation of the OS version, such as `Mac OS X 10.15.3 19D76` I tend to prefer imple...
8c2b5a0583404120f1a910d9af32f40fd1dd9d08
2020-12-27T22:17:38Z
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -101,7 +101,13 @@ jobs: toolchain: ${{ matrix.toolchain }} override: true - - name: Execute tests + - name: Execute tests (not mac) run: cargo test...
[ "375" ]
GuillaumeGomez__sysinfo-377
GuillaumeGomez/sysinfo
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ build = "build.rs" [dependencies] cfg-if = "0.1" -rayon = "^1.0" +rayon = "^1.5" doc-comment = "0.3" once_cell = "1.0" diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,12 @@ ntapi = "0.3" ...
2a2e91cf8cd9319b1dbaa8fb3af889743a06519c
get_disks() doesn't return all mounted disks on Mac OS I've just started learning Rust. I'm on a 2013 MacBook Air running macOS Sierra and rustc 1.48.0 I modified the sysinfo example to just print out the disks in the system. My boot disk is an external USB 3.0 SSD. (The internal SSD has been missing since I got the...
0.15
377
That's intriguing. I'll need to check what's going there. > That's intriguing. I'll need to check what's going there. Thanks Guillaume. I updated the report by fixing a problem in the code that was mixing 0.3 and 0.15 versions of the example code and tested under Windows 10, which has a different problem. In utils.r...
8c2b5a0583404120f1a910d9af32f40fd1dd9d08
2020-10-02T14:52:22Z
diff --git a/tests/process.rs b/tests/process.rs --- a/tests/process.rs +++ b/tests/process.rs @@ -104,3 +104,25 @@ fn test_process_disk_usage() { p.disk_usage().written_bytes ); } + +#[test] +fn cpu_usage_is_not_nan() { + let mut system = sysinfo::System::new(); + system.refresh_processes(); + + ...
[ "366" ]
GuillaumeGomez__sysinfo-367
GuillaumeGomez/sysinfo
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sysinfo" -version = "0.15.2" +version = "0.15.3" authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"] description = "Library to get system information such as processes, processors, disks, components and...
f57031a38b0d527958a58605682c52e262f3f017
Process cpu_usage() returns NaN in some cases Hello, I'm using `sysinfo` on version `0.15.2` on Linux mint 19. `cargo -V` outputs `cargo 1.46.0 (149022b1d 2020-07-17)`. `rustc -V` outputs `rustc 1.46.0 (04488afe3 2020-08-24)`. When `system.refresh_process(pid)` is called too often, the cpu_usage() of this process...
0.15
367
This is indeed where the bug is coming from. However, I'm not too aware on how to compare floats and check if they're equal. If you have any directions, it'd be awesome! (You can also send a PR if you want to go faster :wink: ). I appreciate the quick reply :) there are some crates that handle this, like [float_cmp](...
8c2b5a0583404120f1a910d9af32f40fd1dd9d08
2020-06-01T11:28:42Z
diff --git a/src/sysinfo.rs b/src/sysinfo.rs --- a/src/sysinfo.rs +++ b/src/sysinfo.rs @@ -92,7 +92,7 @@ cfg_if! { #[cfg(test)] const MIN_USERS: usize = 1; - } else if #[cfg(unix)] { + } else if #[cfg(any(target_os = "linux", target_os = "android"))] { mod linux; use linux as...
[ "319" ]
GuillaumeGomez__sysinfo-322
GuillaumeGomez/sysinfo
diff --git a/src/sysinfo.rs b/src/sysinfo.rs --- a/src/sysinfo.rs +++ b/src/sysinfo.rs @@ -151,7 +151,7 @@ mod utils; /// let s = System::new_all(); /// ``` pub fn set_open_files_limit(mut _new_limit: isize) -> bool { - #[cfg(all(not(target_os = "macos"), unix))] + #[cfg(any(target_os = "linux", target_os = "a...
98fb1e1d4fc5187b9701464ebd6674245879bea0
Fails on FreeBSD: cannot find value `CLOCK_BOOTTIME` in crate `libc` ``` error[E0425]: cannot find value `CLOCK_BOOTTIME` in crate `libc` --> /wrkdirs/usr/ports/shells/starship/work/starship-0.41.3/cargo-crates/sysinfo-0.14.2/src/linux/system.rs:121:43 | 121 | if unsafe { libc::clock_gettime(libc::CLOCK_...
0.14
322
I'm surprised that FreeBSD is considered as a unix target... I'm sorry but I have no machine with a FreeBSD installed. So I have two leads to solve this issue: 1. Understand which condition failed, allowing FreeBSD to use unix code. 2. Fix the code directly by using the matching constant on FreeBSD. Practically e...
98fb1e1d4fc5187b9701464ebd6674245879bea0
2020-04-15T13:12:29Z
diff --git a/src/linux/disk.rs b/src/linux/disk.rs --- a/src/linux/disk.rs +++ b/src/linux/disk.rs @@ -148,3 +72,156 @@ impl DiskExt for Disk { } } } + +fn new_disk(name: &OsStr, mount_point: &Path, file_system: &[u8]) -> Disk { + let mount_point_cpath = utils::to_cpath(mount_point); + let type_ = ...
[ "300" ]
GuillaumeGomez__sysinfo-302
GuillaumeGomez/sysinfo
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sysinfo" -version = "0.13.2" +version = "0.13.3" authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"] description = "Library to get system information such as processes, processors, disks, components and...
a6228731cb3464cfc72c3475b2ab0e10448262a0
test_disks fail in Fedora buildsystem ```rust ---- test_disks stdout ---- thread 'test_disks' panicked at 'assertion failed: s.get_disks().len() > 0', tests/disk_list.rs:14:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace failures: test_disks test result: FAILED. 0 passed; 1 fai...
0.13
302
You didn't have this issue before I assume? On 0.12.0 no, but now I upgraded to 0.13.2 and have it :) I suspect #297, which is weird considering that it was supposed to handle more disk kinds... Can you show what your `/proc/mounts` file contains please? ``` tmpfs /proc tmpfs rw,seclabel,relatime 0 0 proc /proc proc ...
a6228731cb3464cfc72c3475b2ab0e10448262a0
2020-03-19T10:58:00Z
diff --git a/src/sysinfo.rs b/src/sysinfo.rs --- a/src/sysinfo.rs +++ b/src/sysinfo.rs @@ -316,3 +316,18 @@ mod test { assert!(s.get_users().len() >= MIN_USERS); } } + +// Used to check that System is Send and Sync. +#[cfg(doctest)] +doc_comment!( + " +``` +fn is_send<T: Send>() {} +is_send::<sysinfo:...
[ "282" ]
GuillaumeGomez__sysinfo-283
GuillaumeGomez/sysinfo
diff --git a/src/unknown/component.rs b/src/unknown/component.rs --- a/src/unknown/component.rs +++ b/src/unknown/component.rs @@ -26,6 +26,5 @@ impl ComponentExt for Component { "" } - fn refresh(&mut self) { - } + fn refresh(&mut self) {} } diff --git a/src/unknown/system.rs b/src/unknown/sy...
90049ce2c712284ee93379e4e5f9c03da41b9ee2
`System` implements `Send` on Linux, but not on Windows As the title says, the `System` struct implements `Send` on Linux, but not on Windows. Take a look at the implemented traits: https://docs.rs/sysinfo/0.11.7/x86_64-pc-windows-msvc/sysinfo/struct.System.html https://docs.rs/sysinfo/0.11.7/sysinfo/struct.Sy...
0.11
283
It shouldn't implement `Send` on any platform. Sending a PR.
90049ce2c712284ee93379e4e5f9c03da41b9ee2
2020-02-10T21:08:36Z
diff --git a/tests/process.rs b/tests/process.rs --- a/tests/process.rs +++ b/tests/process.rs @@ -6,12 +6,12 @@ extern crate sysinfo; +#[cfg(not(windows))] +use sysinfo::ProcessExt; +use sysinfo::SystemExt; + #[test] fn test_process() { - #[cfg(not(windows))] - use sysinfo::ProcessExt; - use sysinfo::S...
[ "261" ]
GuillaumeGomez__sysinfo-262
GuillaumeGomez/sysinfo
diff --git a/src/traits.rs b/src/traits.rs --- a/src/traits.rs +++ b/src/traits.rs @@ -538,7 +538,7 @@ pub trait SystemExt: Sized { fn refresh_processes(&mut self); /// Refresh *only* the process corresponding to `pid`. Returns `false` if the process doesn't - /// exist or isn't listed. + /// exist. I...
d7bfc1e62c91c5f34e9e444bb083fa67716f3051
Different behavior on window for refresh_process Hi, I have a use case where I just ran a new child process, and then I call system.refresh_process(pid), and try to get the process info. Things work fine on linux and mac, however on windows, the process is not found. I suspect windows does not add a new proces...
0.11
262
Great catch and thanks for the precise report! I'll check what's going on.
90049ce2c712284ee93379e4e5f9c03da41b9ee2
2020-01-26T22:19:43Z
diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Support the following platforms: * Linux * Raspberry * Android - * Mac OSX + * macOS * Windows It also compiles for Android but never been tested on it. diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -...
[ "215" ]
GuillaumeGomez__sysinfo-245
GuillaumeGomez/sysinfo
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -16,17 +16,15 @@ build = "build.rs" cfg-if = "0.1" rayon = "^1.0" doc-comment = "0.3" +once_cell = "1.0" [target.'cfg(windows)'.dependencies] -winapi = { version = "0.3", features = ["fileapi", "handleapi", "ioapiset", "minwindef", "pdh", "...
4ae1791d21f84f911ca8a77e3ebc19996b7de808
Feature Request: support retrieve CPU number and load info Thanks for providing the awesome library for retrieving system information. But some information cannot be retrieved by this crate, like CPU number and CPU average load. (So I must use another crate like https://docs.rs/sys-info/0.5.8/sys_info/index.html). I...
0.10
245
Ah indeed. I'll check if it's available as well on windows and OSX, otherwise I'll have a bit more work to do for them.
4ae1791d21f84f911ca8a77e3ebc19996b7de808
2019-06-24T15:31:47Z
diff --git a/src/system.rs b/src/system.rs --- a/src/system.rs +++ b/src/system.rs @@ -25,14 +25,15 @@ mod tests { #[test] fn test_refresh_process() { let mut sys = System::new(); - assert!(sys.refresh_process(utils::get_current_pid())); + assert!(sys.refresh_process(utils::get_current_...
[ "182" ]
GuillaumeGomez__sysinfo-183
GuillaumeGomez/sysinfo
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sysinfo" -version = "0.8.6" +version = "0.9.0" authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"] description = "Library to handle processes" diff --git a/src/utils.rs b/src/utils.rs --- a/src/utils.rs...
5744eb9221c99229f38375d776ee681032ca4f86
Make get_current_pid() return Result to prevent panic on unknown platform
0.8
183
5744eb9221c99229f38375d776ee681032ca4f86
2019-06-22T11:19:14Z
diff --git a/src/sysinfo.rs b/src/sysinfo.rs --- a/src/sysinfo.rs +++ b/src/sysinfo.rs @@ -54,7 +54,6 @@ extern crate cfg_if; extern crate libc; extern crate rayon; -#[cfg(test)] #[macro_use] extern crate doc_comment;
[ "76" ]
GuillaumeGomez__sysinfo-178
GuillaumeGomez/sysinfo
diff --git a/.travis.yml b/.travis.yml --- a/.travis.yml +++ b/.travis.yml @@ -55,7 +55,7 @@ script: - rustc --version - sysctl -a | grep mem - if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then - rustup component add clippy-preview && cargo clippy; + (rustup component add clippy-preview && cargo cli...
bf0691f89ac36af1418a522591cc012ce584d0aa
`sysinfo::System::new()` slow? A simple program creating a `sysinfo::System` takes several times longer to run (after `cargo build --release`) than existing unix utilities from the procps suite (~40ms instead of ~14ms): ``` extern crate sysinfo; use sysinfo::SystemExt; fn main() { let mut system = sysinfo::S...
0.8
178
Even more than reasonable: it sounds great! I'll gladly accept any patch improving the speed of this crate. A first step on improving this issue is done in #88. I'll try to check how to reduce computation times. [Here's the flamegraph of the benchmark.](https://rawgit.com/antoyo/d0169a8bbe8204091f261719b9a93c9d/raw/c0f...
5744eb9221c99229f38375d776ee681032ca4f86
2019-02-28T23:34:55Z
diff --git a/.travis.yml b/.travis.yml --- a/.travis.yml +++ b/.travis.yml @@ -40,14 +40,22 @@ matrix: script: - rustc --version - sysctl -a | grep mem - - cargo install clippy || touch clippy_failed + - if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then + rustup component add clippy-preview && cargo clippy; ...
[ "160" ]
GuillaumeGomez__sysinfo-161
GuillaumeGomez/sysinfo
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -13,9 +13,9 @@ categories = ["filesystem", "os::macos-apis", "os::unix-apis", "os::windows-apis build = "build.rs" [dependencies] -libc = "^0.2" cfg-if = "0.1" rayon = "^1.0" +libc = "0.2" [target.'cfg(windows)'.dependencies] winapi = {...
8cff91770cafe71f388cf8a798fc871509520c1e
Memory usage seems inaccurate I'm writing a improved version of top, and when listing the memory usage of individual processes, I noticed that it doesn't line up with with what's reported by top or activity monitor. Is there any reason that this wouldn't be the case? I'm running MacOS Mojave. ![memory usage](https:/...
0.8
161
> I'm writing a improved version of top, and when listing the memory usage of individual processes, I noticed that it doesn't line up with with what's reported by top or activity monitor. Is there any reason that this wouldn't be the case? I'm running MacOS Mojave. The `Activity Monitor` of Mac doesn't get the same ...
5744eb9221c99229f38375d776ee681032ca4f86
2018-12-12T23:04:24Z
diff --git a/src/system.rs b/src/system.rs --- a/src/system.rs +++ b/src/system.rs @@ -9,7 +9,7 @@ #[cfg(test)] mod tests { - use ::{System, SystemExt}; + use ::{ProcessExt, System, SystemExt}; use ::utils; #[test] diff --git a/src/system.rs b/src/system.rs --- a/src/system.rs +++ b/src/system.rs ...
[ "148" ]
GuillaumeGomez__sysinfo-150
GuillaumeGomez/sysinfo
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sysinfo" -version = "0.6.2" +version = "0.7.0" authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"] description = "Library to handle processes" diff --git a/src/windows/process.rs b/src/windows/process.r...
95d0ba8a80c99f2c6ca67dd3801192dd15e4d51d
`Process` is does not implement `Send + Sync` on windows Hey, on Linux the `Process` struct implements `Send + Sync`, but not on Windows. We have the following [bug report](https://github.com/paritytech/substrate/issues/1253). After looking into the `Process` code for Windows, I think that `HANDLE` is the problem...
0.6
150
It's part of the problem, yes. However, `Process` cannot be used safely between threads. I'll make another check for linux but I think it shouldn't be `Send+Sync` either. I need it internally so I can perform faster computations but that's it. To fix your issue, you'll have to wrap it inside a `Mutex` I guess. I'll ...
95d0ba8a80c99f2c6ca67dd3801192dd15e4d51d
2017-02-17T10:54:44Z
diff --git a/.travis.yml b/.travis.yml --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ script: - cargo install clippy || touch clippy_failed - RUST_BACKTRACE=1 cargo build - if [ ! -f clippy_failed ]; then cargo clippy; fi + - RUST_BACKTRACE=1 cargo test - cd examples - RUST_BACKTRACE=1 cargo buil...
[ "50" ]
GuillaumeGomez__sysinfo-51
GuillaumeGomez/sysinfo
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sysinfo" -version = "0.2.7" +version = "0.2.8" authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"] description = "Library to handle processes" diff --git a/src/linux/disk.rs b/src/linux/disk.rs --- a/sr...
37829411d4186264c24dfa96f15522655d5060bb
panic when get linux disk info The test code is very simple: ``` extern crate sysinfo; use sysinfo::{System, SystemExt}; fn main() { let s = System::new(); println!("total memory: {}", s.get_total_memory()); println!("total cpu cores: {}", s.get_processor_list().len()); } ``` the panic backtr...
0.2
51
My os is ubuntu12.04 ``` $ cat /proc/mounts | grep "/dev/sda" /dev/sda6 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0 /dev/sda1 /boot ext4 rw,relatime,data=ordered 0 0 /dev/sda6 /var/lib/docker/devicemapper ext4 rw,relatime,errors=remount-ro,data=ordered 0 0 ```
37829411d4186264c24dfa96f15522655d5060bb
2022-02-02T20:15:17Z
diff --git a/tests/process.rs b/tests/process.rs --- a/tests/process.rs +++ b/tests/process.rs @@ -254,7 +254,7 @@ fn test_process_times() { std::process::Command::new("waitfor") .arg("/t") .arg("3") - .arg("CwdSignal") + .arg("ProcessTimes") .stdout...
[ "686" ]
GuillaumeGomez__sysinfo-687
GuillaumeGomez/sysinfo
diff --git a/src/common.rs b/src/common.rs --- a/src/common.rs +++ b/src/common.rs @@ -46,6 +46,9 @@ macro_rules! pid_decl { Self(v) } } + #[allow(clippy::from_over_into)] + // This Into implementation is required otherwise it seems you can't do `pid.into()` + ...
8a13566c75b44d51b7da3fc58901e863e72a9e26
[Linux] Issue with process removal logic after calling `refresh_process()` I'm observing an issue with the following scenario: 1) Call `refresh_processes()` 2) Call `refresh_process()` on a running process P 3) Kill the process P 4) Call `refresh_processes()` 5) Call `processes()` to get the list of running proc...
0.23
687
This is definitely a bug. I'll add a test with this scenario to ensure the killed process doesn't show up.
6f1c70092ee030535cc2939960baf41ce331a4b2
2022-01-17T17:26:04Z
diff --git a/tests/process.rs b/tests/process.rs --- a/tests/process.rs +++ b/tests/process.rs @@ -245,6 +245,8 @@ fn cpu_usage_is_not_nan() { #[test] fn test_process_times() { + use std::time::{SystemTime, UNIX_EPOCH}; + if !sysinfo::System::IS_SUPPORTED || cfg!(feature = "apple-sandbox") { return...
[ "680" ]
GuillaumeGomez__sysinfo-681
GuillaumeGomez/sysinfo
diff --git a/src/linux/process.rs b/src/linux/process.rs --- a/src/linux/process.rs +++ b/src/linux/process.rs @@ -10,7 +10,7 @@ use std::str::FromStr; use libc::{gid_t, kill, uid_t}; -use crate::sys::system::REMAINING_FILES; +use crate::sys::system::{SystemInfo, REMAINING_FILES}; use crate::sys::utils::{get_all_...
c1a6c6f2c438d7cf4c947f555df3d6d408ef0fe4
On Linux `ProcessExt::start_time()` does not return the time since the epoch as documented It seems to just return `(22) starttime` from `/proc/[pid]/stat`, see `man proc`: "The time the process started after system boot." `info.process(get_current_pid().unwrap()).unwrap().start_time()` is much smaller than the expe...
0.22
681
It's pretty bad in any case. Interested into sending a PR? Otherwise I'll try to fix it as soon as possible.
c1a6c6f2c438d7cf4c947f555df3d6d408ef0fe4
2022-01-14T22:08:03Z
diff --git /dev/null b/tests/code_checkers/docs.rs new file mode 100644 --- /dev/null +++ b/tests/code_checkers/docs.rs @@ -0,0 +1,135 @@ +// Take a look at the license at the top of the repository in the LICENSE file. + +use super::utils::{show_error, TestResult}; +use std::ffi::OsStr; +use std::path::Path; + +fn to_c...
[ "592" ]
GuillaumeGomez__sysinfo-679
GuillaumeGomez/sysinfo
diff --git a/src/apple/macos/component.rs b/src/apple/macos/component.rs --- a/src/apple/macos/component.rs +++ b/src/apple/macos/component.rs @@ -18,7 +18,7 @@ pub(crate) const COMPONENTS_TEMPERATURE_IDS: &[(&str, &[i8])] = &[ ("Battery", &['T' as i8, 'B' as i8, '0' as i8, 'T' as i8]), // Battery "TB0T" ]; -p...
b1d66813b7a5f35832302e5ed3d4d85ab94e9464
Add check to ensure that types are using common md files and not manual doc comments For example `System` or `Process`.
0.22
679
c1a6c6f2c438d7cf4c947f555df3d6d408ef0fe4
2022-01-14T16:21:58Z
diff --git a/src/lib.rs b/src/lib.rs --- a/src/lib.rs +++ b/src/lib.rs @@ -128,6 +128,52 @@ pub fn set_open_files_limit(mut _new_limit: isize) -> bool { } } +// FIXME: Can be removed once negative trait bounds are supported. +#[cfg(doctest)] +mod doctest { + /// Check that `Process` doesn't implement `Clone`...
[ "609" ]
GuillaumeGomez__sysinfo-678
GuillaumeGomez/sysinfo
diff --git a/src/apple/app_store/process.rs b/src/apple/app_store/process.rs --- a/src/apple/app_store/process.rs +++ b/src/apple/app_store/process.rs @@ -5,7 +5,6 @@ use std::path::Path; use crate::{DiskUsage, Pid, ProcessExt, ProcessStatus, Signal}; #[doc = include_str!("../../../md_doc/process.md")] -#[derive(Cl...
46333182d9a86be3b27adb2e6f34cd75f3620f9c
Ensure that `Clone` isn't implemented on `Process` Can be done by adding a `compile_fail` test in a doc comment.
0.22
678
c1a6c6f2c438d7cf4c947f555df3d6d408ef0fe4
2021-12-08T11:08:48Z
diff --git /dev/null b/.cirrus.yml new file mode 100644 --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,35 @@ +task: + name: rust 1.54 on freebsd 11 + freebsd_instance: + image: freebsd-11-4-release-amd64 + setup_script: + - pkg install -y curl + - curl https://sh.rustup.rs -sSf --output rustup.sh + - sh rust...
[ "622" ]
GuillaumeGomez__sysinfo-627
GuillaumeGomez/sysinfo
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.21.2 + + * Unsupported targets: fix build. + # 0.21.1 * Linux: Process CPU usage cannot go above maximum value (number of CPUs * 100) anymore. diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @...
3e6d919394fd281ffd0e8484cd9020fa0462dc9d
Taking rootfs as a disk by mistake In some kinds of Linux systems, there is a virtual type of filesystem named `rootfs`. However, sysinfo cannot recognize it correctly and takes it as the real disk. This is the version of centos: ``` [VM-9-75-centos ~]$ cat /proc/version Linux version 3.10.0-1062.18.1.el7.x86...
0.21
627
3e6d919394fd281ffd0e8484cd9020fa0462dc9d
2021-11-23T19:49:11Z
diff --git a/.cirrus.yml b/.cirrus.yml --- a/.cirrus.yml +++ b/.cirrus.yml @@ -12,14 +12,14 @@ task: test_script: - . $HOME/.cargo/env - cargo check - - cargo check --example simple - - cargo test - cargo clippy -- -D warnings + - cargo check --example simple + - FREEBSD_CI=1 cargo test -j...
[ "433" ]
GuillaumeGomez__sysinfo-620
GuillaumeGomez/sysinfo
diff --git a/.cirrus.yml b/.cirrus.yml --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,7 +1,7 @@ task: - name: rust 1.54 on freebsd 11 + name: rust 1.54 on freebsd 13 freebsd_instance: - image: freebsd-11-4-release-amd64 + image: freebsd-13-0-release-amd64 setup_script: - pkg install -y curl - curl h...
a2c2a7779336384b726a73567002de19574ec843
Add FreeBSD support? As FreeBSD is still used on lots of places it might be nice to support it. I don't think you want to add this but are you open to PRs to support FreeBSD?
0.21
620
I gave it a try a long time ago but had issues finding some information. If you feel like giving it a try, you're very welcome to do so! Ah that's a bummer, i've always been interested in freebsd but never found any reason to use it so this might be a nice way to learn some new things. Good luck then. :wink: A gener...
3e6d919394fd281ffd0e8484cd9020fa0462dc9d
2021-06-28T13:42:01Z
diff --git a/src/lib.rs b/src/lib.rs --- a/src/lib.rs +++ b/src/lib.rs @@ -341,10 +341,11 @@ mod test { if System::IS_SUPPORTED { assert!(!s.processors().is_empty()); + // In case we are running inside a VM, it's possible to not have a physical core, only + // logical ones,...
[ "519" ]
GuillaumeGomez__sysinfo-529
GuillaumeGomez/sysinfo
diff --git a/src/linux/processor.rs b/src/linux/processor.rs --- a/src/linux/processor.rs +++ b/src/linux/processor.rs @@ -263,10 +263,8 @@ pub fn get_cpu_frequency(cpu_core_index: usize) -> u64 { pub fn get_physical_core_count() -> Option<usize> { let mut s = String::new(); - if File::open("/proc/cpuinfo") ...
3aa83dc410ebe2f6d5063a095104ea6c6394507f
test_physical_core_numbers fails on armv7hl aarch64 and ppc64le ``` ---- test_physical_core_numbers stdout ---- thread 'test_physical_core_numbers' panicked at 'assertion failed: count.unwrap() > 0', tests/processor.rs:36:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace failures: ...
0.18
529
For this one, please show me the content of `/proc/cpuinfo`. Also, why are you running the tests to build a package? Fedora policy is to always run the tests at the end of the build to validate that the package will actually work. This isn't specific to rust, it's done for all packages that have tests available. arm...
3aa83dc410ebe2f6d5063a095104ea6c6394507f
2021-06-11T08:30:22Z
diff --git a/src/system.rs b/src/system.rs --- a/src/system.rs +++ b/src/system.rs @@ -89,4 +89,15 @@ mod tests { assert!(!hostname.contains('\u{0}')) } } + + #[test] + fn check_uptime() { + let sys = System::new(); + let uptime = sys.get_uptime(); + if System::IS_S...
[ "508" ]
GuillaumeGomez__sysinfo-509
GuillaumeGomez/sysinfo
diff --git a/src/linux/system.rs b/src/linux/system.rs --- a/src/linux/system.rs +++ b/src/linux/system.rs @@ -121,7 +121,6 @@ pub struct System { components: Vec<Component>, disks: Vec<Disk>, networks: Networks, - uptime: u64, users: Vec<User>, boot_time: u64, } diff --git a/src/linux/syst...
5c69175f028a5608093d31597b93031d165774c5
Uptime: To cache, or not to cache? I've been looking into FreeBSD support this week (#433), and while trying to implement `SystemExt::get_uptime`, I found an inconsistency. Linux uses whatever value was cached during the most recent refresh. https://github.com/GuillaumeGomez/sysinfo/blob/f8574e459d0b1d65ed649cd08...
0.18
509
Linux should be updated to look like the others. Gonna send a PR which will also enforce this behaviour with a test (and thanks for working on freebsd!).
3aa83dc410ebe2f6d5063a095104ea6c6394507f
2021-06-06T19:49:13Z
diff --git a/src/lib.rs b/src/lib.rs --- a/src/lib.rs +++ b/src/lib.rs @@ -343,8 +343,14 @@ mod test { if System::IS_SUPPORTED { assert!(!s.get_processors().is_empty()); + assert!( + s.get_physical_core_count() + .expect("failed to get number of physi...
[ "502" ]
GuillaumeGomez__sysinfo-503
GuillaumeGomez/sysinfo
diff --git a/examples/src/simple.rs b/examples/src/simple.rs --- a/examples/src/simple.rs +++ b/examples/src/simple.rs @@ -166,6 +166,13 @@ fn interpret_input(input: &str, sys: &mut System) -> bool { "processors" => { // Note: you should refresh a few times before using this, so that usage statist...
05427d4e26b83be87f64865b3c15c9663e5d2e62
Issue getting processor counts on Windows I was wondering why the physical number of CPUs would show up greater than the number of CPU cores on Windows 10? https://github.com/mikemadden42/inv/blob/master/src/main.rs#L33 ``` # Window 10 21H1 Number of cores: 2 Number of physical processors: 3 ``` ``` Get-...
0.18
503
I get that information there: https://github.com/GuillaumeGomez/sysinfo/blob/master/src/windows/tools.rs#L44-L61. Surprisingly, I initiate the vec with "nb processors + 1" but I don't put an extra one into it. This is weird... My bad, the physical core count is actually there: https://github.com/GuillaumeGomez/sysinfo/...
3aa83dc410ebe2f6d5063a095104ea6c6394507f
2021-05-12T19:50:07Z
diff --git a/src/linux/network.rs b/src/linux/network.rs --- a/src/linux/network.rs +++ b/src/linux/network.rs @@ -248,3 +274,51 @@ impl NetworkExt for NetworkData { self.tx_errors } } + +#[cfg(test)] +mod test { + use super::refresh_networks_list_from_sysfs; + use std::collections::HashMap; + u...
[ "479" ]
GuillaumeGomez__sysinfo-481
GuillaumeGomez/sysinfo
diff --git a/src/linux/network.rs b/src/linux/network.rs --- a/src/linux/network.rs +++ b/src/linux/network.rs @@ -9,7 +9,7 @@ use std::io::Read; use std::path::Path; use crate::{NetworkExt, NetworksExt, NetworksIter}; -use std::collections::HashMap; +use std::collections::{hash_map, HashMap}; /// Network interf...
190926a97e50c2abf1b155ea59abba1c23f4ebf0
[Linux] get_networks keeps returning removed interfaces Using `get_networks` with calls to `refresh_networks_list`, new network interfaces are picked up, however they are still returned when they are removed from the system. Small program to reproduce: ``` use std::thread::sleep; use std::time::Duration; use ...
0.17
481
I only gave a quick look, but I think the `self.interface` HashMap needs to be cleared in the beginning of `refresh_networks_list` https://github.com/GuillaumeGomez/sysinfo/blob/master/src/linux/network.rs#L76 Thanks for the issue! The simpler fix here would be to do it in two passes: we first we check if all our netwo...
190926a97e50c2abf1b155ea59abba1c23f4ebf0
2021-03-17T13:54:47Z
diff --git a/src/lib.rs b/src/lib.rs --- a/src/lib.rs +++ b/src/lib.rs @@ -208,6 +208,29 @@ mod test { assert!(s.get_users().len() >= MIN_USERS); } + #[test] + fn check_uid_gid() { + let mut s = System::new(); + assert!(s.get_users().is_empty()); + s.refresh_users_list(); + ...
[ "167" ]
GuillaumeGomez__sysinfo-449
GuillaumeGomez/sysinfo
diff --git a/src/apple/users.rs b/src/apple/users.rs --- a/src/apple/users.rs +++ b/src/apple/users.rs @@ -4,7 +4,10 @@ // Copyright (c) 2020 Guillaume Gomez // -use crate::User; +use crate::{ + common::{Gid, Uid}, + User, +}; use crate::sys::utils; use libc::{c_char, endpwent, getgrgid, getgrouplist, get...
58b31e3a5d2821fb0483125220331b3afab5cd11
Add user id and group id
0.16
449
58b31e3a5d2821fb0483125220331b3afab5cd11
2021-01-26T15:07:08Z
diff --git a/src/sysinfo.rs b/src/sysinfo.rs --- a/src/sysinfo.rs +++ b/src/sysinfo.rs @@ -185,11 +185,11 @@ pub fn set_open_files_limit(mut _new_limit: isize) -> bool { #[cfg(test)] mod test { - use super::*; + use crate::*; #[test] fn check_memory_usage() { - let mut s = ::System::new(); ...
[ "403" ]
GuillaumeGomez__sysinfo-417
GuillaumeGomez/sysinfo
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ readme = "README.md" categories = ["filesystem", "os", "api-bindings"] build = "build.rs" +edition = "2018" [dependencies] cfg-if = "1.0" diff --git a/src/apple/component.rs b/src/apple/component.rs --- a/src/apple/componen...
8c2b5a0583404120f1a910d9af32f40fd1dd9d08
Switch to 2018 edition
0.15
417
8c2b5a0583404120f1a910d9af32f40fd1dd9d08
2021-01-25T20:57:53Z
diff --git a/src/sysinfo.rs b/src/sysinfo.rs --- a/src/sysinfo.rs +++ b/src/sysinfo.rs @@ -222,8 +223,18 @@ mod test { if MIN_USERS > 0 { let s = System::new(); assert!(!s.get_name().expect("Failed to get system name").is_empty()); + + cfg_if! { + if #[cfg(no...
[ "413" ]
GuillaumeGomez__sysinfo-414
GuillaumeGomez/sysinfo
diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -91,9 +91,10 @@ for (pid, process) in sys.get_processes() { } // Display system information: -println!("System name: {:?}", sys.get_name()); -println!("System version: {:?}", sys.get_version()); -println!("System host name: {:?}", sys.get_...
639f6afc6dc8808572853b721fa634eefd06b489
`get_version()` returns kernel version on MacOS and iOS `get_verison()` will return the compiled kernel version of MacOS and not the "product" version of MacOS/iOS. This is a problem because while the kernel version is still needed we currently have no way to get the more recognizable system version for system informa...
0.15
414
8c2b5a0583404120f1a910d9af32f40fd1dd9d08
2021-01-09T18:09:21Z
diff --git a/src/sysinfo.rs b/src/sysinfo.rs --- a/src/sysinfo.rs +++ b/src/sysinfo.rs @@ -97,6 +97,9 @@ cfg_if! { } else if #[cfg(any(target_os = "linux", target_os = "android"))] { mod linux; use linux as sys; + // Can remove once `slice_internals` is stabilized + // https://doc.r...
[ "390" ]
GuillaumeGomez__sysinfo-393
GuillaumeGomez/sysinfo
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,9 @@ core-foundation-sys = "0.8" [target.'cfg(any(target_os = "macos", target_os = "ios"))'.build-dependencies] cc = "1.0" +[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies] +memchr = "2.3" + [lib] name ...
d162ddd4e2f5ebf1139779b3c57304b3542bbc7f
Add `hostname` support It would be *really* nice for this crate to support getting a system's hostname to get the network name of the host. e.g. equivalent to `/bin/hostname`'s output. Sorry if I missed this somewhere in the docs!
0.15
393
`sysinfo` doesn't provide this information yet. From what I can see, on unix-like systems, it just needs to call the `gethostname` function. On windows it's [getcomputernamea](https://docs.microsoft.com/fr-fr/windows/win32/api/winbase/nf-winbase-getcomputernamea). Interested into sending a PR maybe?
8c2b5a0583404120f1a910d9af32f40fd1dd9d08
2024-12-04T00:06:06Z
diff --git a/benches/basic.rs b/benches/basic.rs --- a/benches/basic.rs +++ b/benches/basic.rs @@ -127,6 +127,6 @@ fn bench_refresh_users_list(b: &mut test::Bencher) { let mut users = sysinfo::Users::new_with_refreshed_list(); b.iter(move || { - users.refresh_list(); + users.refresh(); })...
[ "1405" ]
GuillaumeGomez__sysinfo-1411
GuillaumeGomez/sysinfo
diff --git a/examples/simple.rs b/examples/simple.rs --- a/examples/simple.rs +++ b/examples/simple.rs @@ -163,7 +163,7 @@ fn interpret_input( } "refresh_users" => { writeln!(&mut io::stdout(), "Refreshing user list..."); - users.refresh_list(); + users.refresh(); ...
ee9d6da5bb7794be56acd100406fd1b0200bced5
Remove `refresh_list` methods It's not very coherent with how processes are refreshed. And now with https://github.com/GuillaumeGomez/sysinfo/pull/1404, it makes even less sense to have that. Better just refresh everything and keep the current items.
0.32
1,411
ee9d6da5bb7794be56acd100406fd1b0200bced5
2024-11-22T21:12:44Z
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -115,6 +115,7 @@ tempfile = "3.9" serde_json = "1.0" # Used in documentation tests. bstr = "1.9.0" tempfile = "3.9" +itertools = "0.13.0" [[example]] name = "simple" diff --git a/tests/disk.rs b/tests/disk.rs --- a/tests/disk.rs +++ b/test...
[ "1375" ]
GuillaumeGomez__sysinfo-1387
GuillaumeGomez/sysinfo
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -103,7 +103,7 @@ ntapi = { version = "0.4", optional = true } windows = { version = ">=0.54, <=0.57", optional = true } [target.'cfg(not(any(target_os = "unknown", target_arch = "wasm32")))'.dependencies] -libc = "^0.2.165" +libc = "^0.2.164"...
5721f848f7e9b5d883e4ff7f88bd0b297d4ee05c
Selectively refreshing disks When running `Disks::new_with_refreshed_list()` on android devices, I often see warnings (from SELinux?) along the lines of: ``` type=1400 audit(0.0:339351): avc: denied { search } for name="block" dev="tmpfs" ino=12 ``` I've done some spelunking, and it appears they are a side-e...
0.32
1,387
Seems a bit weird to want to have disks but not their path or even their kind. I think the best course would be to instead detect when the `canonicalize` call is actually needed and only call it if so. > Seems a bit weird to want to have disks but not their path or even their kind. I was thinking those *would* be pr...
ee9d6da5bb7794be56acd100406fd1b0200bced5
2024-10-07T21:44:33Z
diff --git a/src/common/system.rs b/src/common/system.rs --- a/src/common/system.rs +++ b/src/common/system.rs @@ -2462,7 +2462,7 @@ mod test { #[test] fn check_cpu_arch() { - assert_eq!(System::cpu_arch().is_some(), IS_SUPPORTED_SYSTEM); + assert!(!System::cpu_arch().is_empty()); } ...
[ "1356" ]
GuillaumeGomez__sysinfo-1358
GuillaumeGomez/sysinfo
diff --git a/src/common/system.rs b/src/common/system.rs --- a/src/common/system.rs +++ b/src/common/system.rs @@ -777,8 +777,8 @@ impl System { /// /// println!("CPU Architecture: {:?}", System::cpu_arch()); /// ``` - pub fn cpu_arch() -> Option<String> { - SystemInner::cpu_arch() + pub fn ...
e022ae4fd1d27c2d7159cad3e7018fc08e5b822d
Use std::env::consts::ARCH for System::cpu_arch The `std::env::consts::ARCH` constant can be used instead of computing the value for every call to the function.
0.32
1,358
Interested into sending a PR? > Interested into sending a PR? Should the function fallback to `std::env::consts::ARCH` if `SystemInner::cpu_arch` returns `None`? Sounds good to me!
ee9d6da5bb7794be56acd100406fd1b0200bced5
2024-10-03T21:06:38Z
diff --git a/benches/basic.rs b/benches/basic.rs --- a/benches/basic.rs +++ b/benches/basic.rs @@ -33,9 +33,9 @@ fn bench_refresh_all(b: &mut test::Bencher) { fn bench_refresh_processes(b: &mut test::Bencher) { let mut s = sysinfo::System::new(); - s.refresh_processes(sysinfo::ProcessesToUpdate::All); // to ...
[ "1340" ]
GuillaumeGomez__sysinfo-1353
GuillaumeGomez/sysinfo
diff --git a/examples/simple.rs b/examples/simple.rs --- a/examples/simple.rs +++ b/examples/simple.rs @@ -408,7 +408,7 @@ fn interpret_input( .take(1) .next() { - if sys.refresh_processes(sysinfo::ProcessesToUpdate::Some(&[pid])) != 0 { + ...
6f1d3822765b3ba3b9fe774d8d2e3798c31fce5d
Add some way to remove a closed process I'm attaching to specific individual processes and want to know when they are closed, so I use ```rust if system.refresh_processes_specifics(ProcessesToUpdate::Some(&[pid]), ProcessRefreshKind::new()) == 0 { ... } ``` to check for that situation. Unfortunately as state...
0.31
1,353
Interesting: I was thinking about adding a new `remove_dead_processes` boolean field in `ProcessProcessKind` or as new parameter. Not clear yet. I suppose it would fix your case? Yeah absolutely, as long as it doesn't wastefully have to scan the entire process list or so. Sadly it kinda still needs to iterate processes...
6f1d3822765b3ba3b9fe774d8d2e3798c31fce5d
2024-07-24T20:46:11Z
diff --git a/tests/process.rs b/tests/process.rs --- a/tests/process.rs +++ b/tests/process.rs @@ -813,3 +813,47 @@ fn test_parent_change() { // We kill the child to clean up. child.kill(); } + +// We want to ensure that if `System::refresh_process*` methods are called +// one after the other, it won't impac...
[ "1299" ]
GuillaumeGomez__sysinfo-1324
GuillaumeGomez/sysinfo
diff --git a/src/common/system.rs b/src/common/system.rs --- a/src/common/system.rs +++ b/src/common/system.rs @@ -367,6 +367,9 @@ impl System { /// exist (it will **NOT** be removed from the processes if it doesn't exist anymore). If it /// isn't listed yet, it'll be added. /// + /// ⚠️ If you need t...
296bbf02359b11eef28fc344832760b654215a22
Refreshing multiple processes on macos leads to invalid cpu usage I have a piece of code that looks like this: ```rust let mut sys = sysinfo::System::new(); let process_refresh_kind = ProcessRefreshKind::everything().without_disk_usage().without_environ(); sys.refresh_process_specifics(pid_a, process_refresh_kind...
0.30
1,324
For this kind of operations, you likely want to use [refresh_pids_specifics](https://docs.rs/sysinfo/latest/sysinfo/struct.System.html#method.refresh_pids_specifics). Although, in this case it should still work. Indeed, I didn't know about this API, and it fixes the issue. I'm leaving this issue open since there is sti...
296bbf02359b11eef28fc344832760b654215a22
2024-04-10T14:17:27Z
diff --git /dev/null b/tests/components.rs new file mode 100644 --- /dev/null +++ b/tests/components.rs @@ -0,0 +1,17 @@ +// Take a look at the license at the top of the repository in the LICENSE file. + +#[test] +fn test_components() { + use std::env::var; + + let mut c = sysinfo::Components::new(); + assert!...
[ "1245" ]
GuillaumeGomez__sysinfo-1249
GuillaumeGomez/sysinfo
diff --git a/src/unix/linux/component.rs b/src/unix/linux/component.rs --- a/src/unix/linux/component.rs +++ b/src/unix/linux/component.rs @@ -374,16 +374,15 @@ impl ComponentsInner { continue; }; let entry = entry.path(); - if !file_type.is_dir() - ...
93f9b823c1a5cd56f271e48cf879ede312914c64
Temperatures on Linux unavailable A commit on April 7, 2024 causes temperatures on Linux to not be available. The `temperature` command in `examples/simple.rs` no longer prints anything on commit [87c627c1ff07c6a43060c397bcb401e5d72d33e0](https://github.com/GuillaumeGomez/sysinfo/commit/87c627c1ff07c6a43060c397bcb401e...
0.30
1,249
296bbf02359b11eef28fc344832760b654215a22
2024-01-04T18:06:14Z
diff --git a/.cirrus.yml b/.cirrus.yml --- a/.cirrus.yml +++ b/.cirrus.yml @@ -37,14 +37,14 @@ task: - FREEBSD_CI=1 cargo test --lib -j1 -- --ignored task: - name: rust 1.70 on mac m1 + name: rust 1.74 on mac m1 macos_instance: image: ghcr.io/cirruslabs/macos-monterey-base:latest setup_script: ...
[ "1190" ]
GuillaumeGomez__sysinfo-1196
GuillaumeGomez/sysinfo
diff --git a/.cirrus.yml b/.cirrus.yml --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,10 +1,10 @@ task: - name: rust 1.70 on freebsd 13 + name: rust 1.74 on freebsd 13 freebsd_instance: image: freebsd-13-1-release-amd64 setup_script: - curl https://sh.rustup.rs -sSf --output rustup.sh - - sh rustup.sh ...
622cd8a1b3a60983c15273e82bb9fdf9e9fb6177
Process List incomplete on long names **Describe the bug** This is on 0.30.3. The issue is that the stat file on Linux is parsed under the assumption that it contains valid UTF-8. This is not necessarily the case for two reasons: 1. Process names don't need to be valid UTF-8 at all on Linux. They can contain invalid ...
0.30
1,196
Thanks for the detailed description! Using `OsStr` is the best solution here I think. I see that you can get a process/thread name with `pthread_getname_np` or by reading the proc `comm` file. Not sure if it's worth it though.
296bbf02359b11eef28fc344832760b654215a22
2023-12-17T22:57:54Z
diff --git a/src/lib.rs b/src/lib.rs --- a/src/lib.rs +++ b/src/lib.rs @@ -365,34 +365,33 @@ mod test { #[test] fn check_system_info() { - let s = System::new(); - // We don't want to test on unsupported systems. if IS_SUPPORTED { - assert!(!s.name().expect("Failed to get...
[ "1138" ]
GuillaumeGomez__sysinfo-1171
GuillaumeGomez/sysinfo
diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -54,10 +54,10 @@ println!("total swap : {} bytes", sys.total_swap()); println!("used swap : {} bytes", sys.used_swap()); // Display system information: -println!("System name: {:?}", sys.name()); -println!("System kernel version: ...
3cc9cc814d21b7977a0e7bb8260a7b64529e6a1b
Extract "standalone" methods from `System` If they don't need information stored in `System`, they shouldn't be a method of it.
0.29
1,171
3cc9cc814d21b7977a0e7bb8260a7b64529e6a1b
2023-12-17T17:21:49Z
diff --git a/tests/process.rs b/tests/process.rs --- a/tests/process.rs +++ b/tests/process.rs @@ -474,7 +474,7 @@ fn test_wait_child() { std::process::Command::new("waitfor") .arg("/t") .arg("300") - .arg("RefreshProcess") + .arg("WaitChild") .stdou...
[ "1133" ]
GuillaumeGomez__sysinfo-1170
GuillaumeGomez/sysinfo
diff --git a/src/common.rs b/src/common.rs --- a/src/common.rs +++ b/src/common.rs @@ -265,7 +265,65 @@ impl System { /// s.refresh_processes_specifics(ProcessRefreshKind::new()); /// ``` pub fn refresh_processes_specifics(&mut self, refresh_kind: ProcessRefreshKind) { - self.inner.refresh_process...
05d5c2cbfe823a792333841547d5c251db99fb1b
Allow to refresh multiple PIDs at once (so it can be multithreaded) Adding methods called `refresh_pids` and `refresh_pids_specifics`.
0.29
1,170
I took a look at this and on linux, I need to figure out if the `/proc/[PID]/task/` reading is really necessary. I couldn't find a reason why it was actually useful but I'll continue to investigate. More explanations about the `task` folder [here](https://github.com/htop-dev/htop/issues/1341). Not a problem, the tasks ...
3cc9cc814d21b7977a0e7bb8260a7b64529e6a1b
2023-11-29T16:35:14Z
diff --git a/tests/process.rs b/tests/process.rs --- a/tests/process.rs +++ b/tests/process.rs @@ -34,7 +34,7 @@ fn test_cwd() { if let Some(p) = p { assert_eq!(p.pid(), pid); - assert_eq!(p.cwd(), std::env::current_dir().unwrap()); + assert_eq!(p.cwd().unwrap(), &std::env::current_dir().u...
[ "1137" ]
GuillaumeGomez__sysinfo-1162
GuillaumeGomez/sysinfo
diff --git a/src/c_interface.rs b/src/c_interface.rs --- a/src/c_interface.rs +++ b/src/c_interface.rs @@ -462,7 +462,7 @@ pub extern "C" fn sysinfo_process_executable_path(process: CProcess) -> RString assert!(!process.is_null()); let process = process as *const Process; unsafe { - if let Some(p)...
8737fa06afbf879062551d77ed60b0e10c250464
Make `Process::root` return an `Option` It can be a non-available information and as such, should return an `Option` rather than an empty `Path`. (For example it's empty on mac)
0.29
1,162
3cc9cc814d21b7977a0e7bb8260a7b64529e6a1b
2023-11-29T15:55:10Z
diff --git a/tests/process.rs b/tests/process.rs --- a/tests/process.rs +++ b/tests/process.rs @@ -2,28 +2,6 @@ use sysinfo::{Pid, ProcessRefreshKind, System, UpdateKind}; -#[test] -fn test_process() { - let mut s = System::new(); - assert_eq!(s.processes().len(), 0); - s.refresh_processes(); - if !sys...
[ "1141" ]
GuillaumeGomez__sysinfo-1161
GuillaumeGomez/sysinfo
diff --git a/src/common.rs b/src/common.rs --- a/src/common.rs +++ b/src/common.rs @@ -221,13 +221,14 @@ impl System { /// It does the same as: /// /// ```no_run - /// # use sysinfo::{ProcessRefreshKind, System}; + /// # use sysinfo::{ProcessRefreshKind, System, UpdateKind}; /// # let mut syst...
9fb48e65376a6b479e8f134d38c6b38068436804
Should `exe` be included in default process retrieval (and removed from `ProcessRefreshKind`)? It seems to be a basic information that everyone might want all the time.
0.29
1,161
Another solution would be to just remove `refresh_process[es]`.
3cc9cc814d21b7977a0e7bb8260a7b64529e6a1b
2023-10-14T21:57:41Z
diff --git a/src/unix/apple/macos/process.rs b/src/unix/apple/macos/process.rs --- a/src/unix/apple/macos/process.rs +++ b/src/unix/apple/macos/process.rs @@ -699,19 +687,3 @@ fn parse_command_line<T: Deref<Target = str> + Borrow<str>>(cmd: &[T]) -> Vec<St } command } - -#[cfg(test)] -mod test { - use sup...
[ "1094" ]
GuillaumeGomez__sysinfo-1097
GuillaumeGomez/sysinfo
diff --git a/src/unix/apple/macos/process.rs b/src/unix/apple/macos/process.rs --- a/src/unix/apple/macos/process.rs +++ b/src/unix/apple/macos/process.rs @@ -1,6 +1,5 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::ffi::CStr; use std::mem::{self, MaybeUninit}; use std:...
12bb072a2dca91e271b3da45008bb162d258b02b
macos process.root() is returning the PATH env var **Describe the bug** On MacOS in nushell, I'm writing a small process information command to inspect nushell memory on demand. The code is working great on Windows but on MacOS, process.root() is returning the system PATH instead of the root folder where the executabl...
0.29
1,097
What is: > the system PATH ? Shod me the path you expect and the one you get, might be better to understand for me. Sorry for not being clearer. The system PATH is probably mischaracterized but it's supposed to mean the environment variable named PATH on unix type systems. In this image you can see the path I ...
3cc9cc814d21b7977a0e7bb8260a7b64529e6a1b
2023-09-29T14:40:58Z
diff --git a/tests/process.rs b/tests/process.rs --- a/tests/process.rs +++ b/tests/process.rs @@ -659,3 +659,23 @@ fn test_process_creds() { true })); } + +// Regression test for <https://github.com/GuillaumeGomez/sysinfo/issues/1084> +#[test] +fn test_process_memory_refresh() { + if !sysinfo::IS_SUP...
[ "1084" ]
GuillaumeGomez__sysinfo-1085
GuillaumeGomez/sysinfo
diff --git a/src/windows/process.rs b/src/windows/process.rs --- a/src/windows/process.rs +++ b/src/windows/process.rs @@ -489,6 +489,7 @@ impl ProcessInner { if refresh_kind.disk_usage() { update_disk_usage(self); } + update_memory(self); self.run_time = now.saturating_su...
a728002ac8bc33f0d868776ad4044b2931d3a7b2
process memory/virtual_memory on windows is only set on second refresh Tested on sysinfo master (f6c1a25aa22ff323087b5e35c5014d1d81f7fe7d). Here is a code showing the issue: ```rust use sysinfo::{Pid, PidExt, ProcessExt, ProcessRefreshKind, System, SystemExt}; fn main() { let mut args = std::env::args();...
0.29
1,085
3cc9cc814d21b7977a0e7bb8260a7b64529e6a1b
2023-09-14T20:59:50Z
diff --git a/src/lib.rs b/src/lib.rs --- a/src/lib.rs +++ b/src/lib.rs @@ -22,52 +22,24 @@ cfg_if::cfg_if! { #[cfg(test)] pub(crate) const MIN_USERS: usize = 0; - } else if #[cfg(any(target_os = "macos", target_os = "ios"))] { - mod apple; - use apple as sys; - pub(crate) mod...
[ "1038" ]
GuillaumeGomez__sysinfo-1062
GuillaumeGomez/sysinfo
diff --git a/src/macros.rs b/src/macros.rs --- a/src/macros.rs +++ b/src/macros.rs @@ -60,7 +60,7 @@ macro_rules! declare_signals { #[cfg(all(unix, not(feature = "unknown-ci")))] macro_rules! retry_eintr { (set_to_0 => $($t:tt)+) => {{ - let errno = crate::libc_errno(); + let errno = crate::unix::l...
ffd95c1a84cee358f3a73411f38599357d323619
Move unix-like targets into a unix sub-folder to have better folder hierarchy FreeBSD, linux and macOS should be moved into it alongside `src/users.rs` and `src/network_helper_nix.rs`.
0.29
1,062
3cc9cc814d21b7977a0e7bb8260a7b64529e6a1b
2023-07-21T16:30:34Z
diff --git a/src/lib.rs b/src/lib.rs --- a/src/lib.rs +++ b/src/lib.rs @@ -275,7 +275,7 @@ mod test { .all(|(_, proc_)| proc_.cpu_usage() == 0.0)); // Wait a bit to update CPU usage values - std::thread::sleep(std::time::Duration::from_millis(100)); + std::thread::sleep(System::MIN...
[ "881" ]
GuillaumeGomez__sysinfo-1017
GuillaumeGomez/sysinfo
diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -97,9 +97,9 @@ loop { for cpu in sys.cpus() { print!("{}% ", cpu.cpu_usage()); } - // Sleeping for 500 ms to let time for the system to run for long + // Sleeping to let time for the system to run for long // enough to h...
ab2d268ca4bad60be367a4893161b520955aae4a
Process data inconsistency between `refresh_processes_specifics` and `refresh_process_specifics` Thanks for all your work on sysinfo! I have found a way to get inconsistent data (or at least inconsistent process names) regarding a given process: * `system.refresh_processes_specifics()` (without any PID given) uses ...
0.29
1,017
First, thanks for the issue and the very complete explanations. Both `refresh_process` and `refresh_processes` should gather coherent data. So if you're motivated to write a fix, it's very welcome! OK, I'll try to have a look at it. Which path do you think would make most sense? * using `NtQuerySystemInformation` t...
3cc9cc814d21b7977a0e7bb8260a7b64529e6a1b
2023-05-05T14:53:18Z
diff --git a/tests/process.rs b/tests/process.rs --- a/tests/process.rs +++ b/tests/process.rs @@ -615,3 +615,47 @@ fn test_process_cpu_usage() { assert!(process.cpu_usage() <= max_usage); } } + +#[test] +fn test_process_creds() { + use sysinfo::{ProcessExt, System, SystemExt}; + + if !sysinfo::Sys...
[ "970" ]
GuillaumeGomez__sysinfo-977
GuillaumeGomez/sysinfo
diff --git a/src/apple/app_store/process.rs b/src/apple/app_store/process.rs --- a/src/apple/app_store/process.rs +++ b/src/apple/app_store/process.rs @@ -76,10 +76,18 @@ impl ProcessExt for Process { None } + fn effective_user_id(&self) -> Option<&Uid> { + None + } + fn group_id(&self...
41367e7f05b6fcafee328db5ba5859a00b2e2156
Wrong userid for process sometimes returned on Linux **Describe the bug** sysinfo version 0.28.3, platform is Amazon Linux 2 (also reproed on Ubuntu) `sysinfo` always reports a userid of `root` on Linux for processes with the `dumpable` attribute set to a value other than `1`. This is because it attempts to get t...
0.28
977
Thanks for the detailed report. Interested into sending a fix maybe? So turns out on Linux, `sysinfo` gives you the effective UID and GID only, leaving behind real, saved and filesystem IDs. However, on FreeBSD it gives you real IDs instead. :( I actually don't know what the last ones are even so I'd ignore them (until...
41367e7f05b6fcafee328db5ba5859a00b2e2156
2023-01-17T12:46:36Z
diff --git a/src/system.rs b/src/system.rs --- a/src/system.rs +++ b/src/system.rs @@ -164,7 +164,7 @@ mod tests { for pid in &pids { sys.refresh_process_specifics(*pid, ProcessRefreshKind::new().with_cpu()); } - // To ensure that linux doesn't give too high numbers...
[ "905" ]
GuillaumeGomez__sysinfo-924
GuillaumeGomez/sysinfo
diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# sysinfo ![img_github_ci] [![][img_crates]][crates] [![][img_doc]][doc] +# sysinfo [![][img_crates]][crates] [![][img_doc]][doc] `sysinfo` is a crate used to get a system's information. diff --git a/README.md b/README.md --- a/REA...
2e28eea78967c43e8a8edbb6a61b7cdb988007ce
process.cpu_usage() is 0 When I use the following code to get the cpu usage of each process, it returns 0, both on windwos and mac ``` use sysinfo::{NetworkExt, NetworksExt, ProcessExt, System, SystemExt}; fn main() { let mut sys = System::new_all(); sys.refresh_all(); for (pid, process) in sys.pro...
0.27
924
It's something I'm working on in https://github.com/GuillaumeGomez/sysinfo/pull/903. I need to add a timeout to not refresh the system time too often. > It's something I'm working on in #903. I need to add a timeout to not refresh the system time too often. Looking forward to updating as soon as possible. Start of the...
2e28eea78967c43e8a8edbb6a61b7cdb988007ce
2023-01-16T16:45:43Z
diff --git a/src/system.rs b/src/system.rs --- a/src/system.rs +++ b/src/system.rs @@ -129,10 +129,9 @@ mod tests { return; } - let mut sys = System::new(); - sys.refresh_processes_specifics(ProcessRefreshKind::new().with_cpu()); - sys.refresh_cpu(); + let mut sys = S...
[ "918" ]
GuillaumeGomez__sysinfo-919
GuillaumeGomez/sysinfo
diff --git a/src/apple/cpu.rs b/src/apple/cpu.rs --- a/src/apple/cpu.rs +++ b/src/apple/cpu.rs @@ -207,7 +207,7 @@ pub(crate) fn init_cpus( let frequency = if refresh_kind.frequency() { get_cpu_frequency() } else { - 0 + global_cpu.frequency }; unsafe { diff --git a/src/appl...
a02d518033cf8712a13bce82cc09b1b8dda4006a
oddly high CPU usage values on macOS systems after 0.27.4 I was recently updating some stuff to 0.27.4, when I noticed that there were some process CPU usages that were fine before were way too high now, up in the thousands, which seems really weird. I first thought I was perhaps not updating correctly, or that I forgo...
0.27
919
The problem before `0.27.4` was that the system time (used to compute CPU usage) was recomputed every time `refresh_process` was called. So for each process updated through this method, the CPU usage was 0 or very close to 0, which was wrong. So I added a minimum update time (which is stored in [this constant](https://...
2e28eea78967c43e8a8edbb6a61b7cdb988007ce
2022-12-07T10:58:49Z
diff --git a/tests/code_checkers/docs.rs b/tests/code_checkers/docs.rs --- a/tests/code_checkers/docs.rs +++ b/tests/code_checkers/docs.rs @@ -38,8 +38,7 @@ fn check_md_doc_path(p: &Path, md_line: &str, ty_line: &str) -> bool { show_error( p, &format!( - ...
[ "886" ]
GuillaumeGomez__sysinfo-887
GuillaumeGomez/sysinfo
diff --git a/examples/simple.rs b/examples/simple.rs --- a/examples/simple.rs +++ b/examples/simple.rs @@ -342,11 +342,7 @@ fn interpret_input(input: &str, sys: &mut System) -> bool { let minutes = uptime / 60; writeln!( &mut io::stdout(), - "{} days {} hours {}...
abe8e369d0cee1cf85ddc2d864da875c6312d524
linux: environ is truncated for long environ ``` $ wc -c /proc/882252/environ 30417 /proc/882252/environ ``` environ for this process is truncated approximately half way through
0.26
887
suspicious size matching truncation: https://github.com/GuillaumeGomez/sysinfo/blob/master/src/linux/process.rs#L623 Nice catch! It should indeed add a size check when reading the file.
abe8e369d0cee1cf85ddc2d864da875c6312d524
2022-12-01T12:55:37Z
diff --git a/src/common.rs b/src/common.rs --- a/src/common.rs +++ b/src/common.rs @@ -962,4 +991,23 @@ mod tests { fn check_display_impl_process_status() { println!("{} {:?}", ProcessStatus::Parked, ProcessStatus::Idle); } + + // This test exists to ensure that the `TryFrom<usize>` and `FromStr` ...
[ "883" ]
GuillaumeGomez__sysinfo-884
GuillaumeGomez/sysinfo
diff --git a/src/common.rs b/src/common.rs --- a/src/common.rs +++ b/src/common.rs @@ -2,7 +2,7 @@ use crate::{NetworkData, Networks, NetworksExt, UserExt}; -use std::convert::From; +use std::convert::{From, TryFrom}; use std::fmt; use std::str::FromStr; diff --git a/src/common.rs b/src/common.rs --- a/src/com...
8be83e1cfbc75e8594b14332a8786978540ff6ff
Uid::from() Hey guys! Is Uid::from() method is implemented yet? Cause right now Pid::from() forking fine, but Uid::from() required Uid object anyway.
0.26
884
No it's not as no one asked for it. I'll add it today. Thanks are lot! Same for Group please Noted! :laughing: I'll actually go through the newtypes to be sure I don't forget one. Great, thanks!
abe8e369d0cee1cf85ddc2d864da875c6312d524
2022-11-23T15:28:42Z
diff --git a/tests/process.rs b/tests/process.rs --- a/tests/process.rs +++ b/tests/process.rs @@ -293,6 +293,17 @@ fn test_process_times() { } } +// Checks that `session_id` is working. +#[test] +fn test_process_session_id() { + if !sysinfo::System::IS_SUPPORTED || cfg!(feature = "apple-sandbox") { + ...
[ "783" ]
GuillaumeGomez__sysinfo-878
GuillaumeGomez/sysinfo
diff --git a/md_doc/pid.md b/md_doc/pid.md --- a/md_doc/pid.md +++ b/md_doc/pid.md @@ -1,4 +1,4 @@ -Process id +Process ID. Can be used as an integer type by simple casting. For example: diff --git a/src/apple/app_store/process.rs b/src/apple/app_store/process.rs --- a/src/apple/app_store/process.rs +++ b/src/appl...
0818da38903a7597cb315a1a2bb5392fe0d2e336
[Feature Request] Process session id A session id is used to group processes within a session. For mac/bsd/linix it can be obtained from the [getsid](https://docs.rs/libc/0.2.124/i686-unknown-linux-gnu/libc/fn.getsid.html) system call For windows it can be found in the [SYSTEM_PROCESS_INFORMATION](https://microso...
0.26
878
For windows, we can wrap it into an `Option` like we do for the other process IDs. Interested into sending a PR?
abe8e369d0cee1cf85ddc2d864da875c6312d524
2022-09-25T00:36:37Z
diff --git a/src/lib.rs b/src/lib.rs --- a/src/lib.rs +++ b/src/lib.rs @@ -328,9 +328,10 @@ mod test { #[test] fn check_system_info() { + let s = System::new(); + // We don't want to test on unsupported systems. if System::IS_SUPPORTED { - let s = System::new(); ...
[ "843" ]
GuillaumeGomez__sysinfo-844
GuillaumeGomez/sysinfo
diff --git a/src/apple/system.rs b/src/apple/system.rs --- a/src/apple/system.rs +++ b/src/apple/system.rs @@ -605,6 +605,10 @@ impl SystemExt for System { } } } + + fn distribution_id(&self) -> String { + std::env::consts::OS.to_owned() + } } impl Default for System { diff -...
d5ad6dff70a2e019f8f7ff83e34775c8a20d94bb
Machine-parseable equivalent to System::name() Hi, [os-release](https://www.freedesktop.org/software/systemd/man/os-release.html) documents `NAME=` as a human-presentable name of a distro, and `ID=` as a machine-readable identifier. `System::name()` currently relies on `os-release.NAME`, which makes it less than ideal...
0.26
844
It can be added. The question as always is: "what should it return for other OSes?". On linux you have different distributions so it makes sense, but I think it's the only case. For windows you only have windows, same for macOS. For FreeBSD it could make sense too? Personally I think it can be the OS name if /etc/os-re...
abe8e369d0cee1cf85ddc2d864da875c6312d524
2022-09-03T12:49:44Z
diff --git a/src/lib.rs b/src/lib.rs --- a/src/lib.rs +++ b/src/lib.rs @@ -469,4 +469,19 @@ mod test { (new_total - total).abs() ); } + + // We ensure that the `Process` cmd information is retrieved as expected. + #[test] + fn check_cmd_line() { + if !System::IS_SUPPORTED { + ...
[ "833" ]
GuillaumeGomez__sysinfo-835
GuillaumeGomez/sysinfo
diff --git a/src/linux/process.rs b/src/linux/process.rs --- a/src/linux/process.rs +++ b/src/linux/process.rs @@ -353,6 +353,7 @@ fn retrieve_all_new_process_info( if refresh_kind.user() { refresh_user_group_ids(&mut p, &mut tmp); + tmp.pop(); } if proc_list.pid.0 != 0 { diff --git a...
c7046eb4e189afcfb140057caa581d835e1cc51d
Obtaining linux command line requires ProcessRefreshKind::with_user() to be set It seems retrieving process user information must be turned on when loading processes in linux for the command line to be retrieved. ### Expected Refreshing a new System with ProcessRefreshKind::new() loads the process command line data...
0.26
835
This is intriguing. Thanks for opening this issue! I'll try to take a look in the next days but don't hesitate to check before if you want.
abe8e369d0cee1cf85ddc2d864da875c6312d524
2022-06-10T12:16:28Z
diff --git a/src/lib.rs b/src/lib.rs --- a/src/lib.rs +++ b/src/lib.rs @@ -444,4 +444,23 @@ mod test { assert_ne!(proc_.frequency(), 0); } } + + // In case `Process::updated` is misused, `System::refresh_processes` might remove them + // so this test ensures that it doesn't happen. + ...
[ "767" ]
GuillaumeGomez__sysinfo-768
GuillaumeGomez/sysinfo
diff --git a/src/apple/macos/process.rs b/src/apple/macos/process.rs --- a/src/apple/macos/process.rs +++ b/src/apple/macos/process.rs @@ -30,7 +30,7 @@ pub struct Process { old_stime: u64, start_time: u64, run_time: u64, - updated: bool, + pub(crate) updated: bool, cpu_usage: f32, user_i...
ad49264fca17c996547c173e4d8ef792c95b16d5
macOS: it's necessary to call `refresh_processes` twice to get them all Using `sysinfo 0.24.2` (also seen on `0.23.13`), with the following code: ```rust use sysinfo::{System, SystemExt}; fn main() { let mut s = System::new_all(); s.refresh_processes(); dbg!(s.processes().len()); s.refresh_pr...
0.24
768
Thanks for the report. I'll try to take a look when I have some time. After some more investigation, the `System::new_all()` gets them all, but then the first `.refresh_processes()` truncate the list and the second fills it again: I added `println!` calls in `refresh_processes_specifics()`: ``` ---- System::new_all...
ad49264fca17c996547c173e4d8ef792c95b16d5
2022-06-07T09:09:59Z
diff --git a/src/apple/macos/process.rs b/src/apple/macos/process.rs --- a/src/apple/macos/process.rs +++ b/src/apple/macos/process.rs @@ -615,3 +625,19 @@ fn parse_command_line<T: Deref<Target = str> + Borrow<str>>(cmd: &[T]) -> Vec<St } command } + +#[cfg(test)] +mod test { + use super::*; + + #[test...
[ "760" ]
GuillaumeGomez__sysinfo-763
GuillaumeGomez/sysinfo
diff --git a/src/apple/macos/process.rs b/src/apple/macos/process.rs --- a/src/apple/macos/process.rs +++ b/src/apple/macos/process.rs @@ -247,12 +247,14 @@ pub(crate) fn compute_cpu_usage( p.updated = true; }*/ +#[inline] pub(crate) fn has_been_updated(p: &mut Process) -> bool { let old = p.updated; ...
f1557bb62eb1b6135fe2e5e7b6f406f84dac3691
Fix path panic The following lines in `src/apple/macos/process.rs` would be buggy: ``` fn do_something(env: &str, root: &mut PathBuf, check: &mut bool) { if *check && env.starts_with("PATH=") { *check = false; *root = Path::new(&env[6..]).to_path_...
0.24
763
Interested into sending a fix?
ad49264fca17c996547c173e4d8ef792c95b16d5
2022-06-03T22:53:19Z
diff --git a/src/apple/processor.rs b/src/apple/cpu.rs --- a/src/apple/processor.rs +++ b/src/apple/cpu.rs @@ -316,18 +314,18 @@ mod test { let sys = System::new_with_specifics( crate::RefreshKind::new().with_cpu(CpuRefreshKind::new().with_cpu_usage()), ); - let processors = sys.pr...
[ "736" ]
GuillaumeGomez__sysinfo-754
GuillaumeGomez/sysinfo
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "sysinfo" version = "0.23.15" authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"] -description = "Library to get system information such as processes, processors, disks, components and networks" +description = "Libr...
6f1c70092ee030535cc2939960baf41ce331a4b2
Rename `processors` method into `cpus` and `Processor` type into `Cpu` `ProcessorExt` into `CpuExt` too.
0.23
754
6f1c70092ee030535cc2939960baf41ce331a4b2
2022-05-20T16:09:59Z
diff --git a/tests/process.rs b/tests/process.rs --- a/tests/process.rs +++ b/tests/process.rs @@ -375,7 +375,7 @@ fn test_refresh_process() { // Let's give some time to the system to clean up... std::thread::sleep(std::time::Duration::from_secs(1)); - s.refresh_process(pid); + assert!(!s.refresh_proc...
[ "741" ]
GuillaumeGomez__sysinfo-743
GuillaumeGomez/sysinfo
diff --git a/src/apple/macos/process.rs b/src/apple/macos/process.rs --- a/src/apple/macos/process.rs +++ b/src/apple/macos/process.rs @@ -302,6 +302,14 @@ unsafe fn get_task_info(pid: Pid) -> libc::proc_taskinfo { task_info } +fn check_if_pid_is_alive(pid: Pid) -> bool { + unsafe { kill(pid.0, 0) == 0 } + ...
13182f50f11646ee958d78a042539491eff6fbdd
refresh_process_specifics won't return false after the process has died Reproducer: ```rust #[test] fn test_repro() { let mut sys = System::new(); let mut cmd = std::process::Command::new("cat").spawn().unwrap(); let cmd_pid = (cmd.id() as i32).into(); sys.refresh_process_specifics(cmd_pid, P...
0.23
743
This [test](https://github.com/GuillaumeGomez/sysinfo/blob/master/tests/process.rs#L341-L381) checks exactly that. Generally, the system doesn't remove processes right away. So maybe wait a bit before checking it again? What could be nice would be to update the documentation about this behaviour though so users aren...
6f1c70092ee030535cc2939960baf41ce331a4b2
2022-03-29T15:35:01Z
diff --git a/tests/process.rs b/tests/process.rs --- a/tests/process.rs +++ b/tests/process.rs @@ -322,6 +322,9 @@ fn test_refresh_processes() { s.refresh_processes(); assert!(s.process(pid).is_some()); + // Check that the process name is not empty. + assert!(!s.process(pid).unwrap().name().is_empty()...
[ "711" ]
GuillaumeGomez__sysinfo-712
GuillaumeGomez/sysinfo
diff --git a/src/windows/process.rs b/src/windows/process.rs --- a/src/windows/process.rs +++ b/src/windows/process.rs @@ -178,10 +178,7 @@ unsafe fn get_exe(process_handler: HANDLE, h_mod: *mut c_void) -> PathBuf { impl Process { pub(crate) fn new_from_pid(pid: Pid, now: u64) -> Option<Process> { unsafe...
bcaba0720be731ba78b4585a3a0578145eb5aed4
Windows: missing process name with refresh_process_specifics(pid, ..) On Windows, `System::refresh_process_specifics()` and `System::refresh_processes_specifics()` are NOT equivalent. The first one fails to retrieve the process name. The following produce an empty name. ```rust let mut system = System::default(); ...
0.23
712
6f1c70092ee030535cc2939960baf41ce331a4b2