mirror of
https://github.com/posborne/rust-pstree.git
synced 2025-01-12 23:36:26 +01:00
rustup: use only stable features of the language
Previously std::path::PathExt was used but this is unstable and duplicates functionality in std::fs::metadata. Just use the stable functionality to support all versions of rust.1 Signed-off-by: Paul Osborne <osbpau@gmail.com>
This commit is contained in:
parent
fe0ed22080
commit
84a04e5dcd
1 changed files with 3 additions and 5 deletions
|
@ -27,8 +27,6 @@
|
|||
// of different items, notably the process name and its parent process id (ppid).
|
||||
// And with that information, we can build the process tree.
|
||||
|
||||
#![feature(path_ext)]
|
||||
|
||||
use std::path::Path;
|
||||
use std::fs;
|
||||
use std::io::prelude::*;
|
||||
|
@ -108,10 +106,10 @@ fn get_process_records() -> Vec<ProcessRecord> {
|
|||
let proc_directory_contents = fs::read_dir(&proc_directory).unwrap();
|
||||
proc_directory_contents.filter_map(|entry| {
|
||||
let entry_path = entry.unwrap().path();
|
||||
if entry_path.is_dir() {
|
||||
if fs::metadata(entry_path.as_path()).unwrap().is_dir() {
|
||||
let status_path = entry_path.join("status");
|
||||
if status_path.exists() {
|
||||
return get_process_record(&status_path)
|
||||
if fs::metadata(status_path.as_path()).unwrap().is_file() {
|
||||
return get_process_record(status_path.as_path())
|
||||
}
|
||||
}
|
||||
None
|
||||
|
|
Loading…
Reference in a new issue