File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ pub fn load_cpu_usage(path: &Path) -> anyhow::Result<Vec<f64>> {
14
14
if cols. len ( ) == 2 {
15
15
if let Ok ( idle) = cols[ 1 ] . parse :: < f64 > ( ) {
16
16
entries. push ( 100.0 - idle) ;
17
+ } else {
18
+ eprintln ! ( "Warning: cannot parse CPU CSV entry {}" , cols[ 1 ] ) ;
17
19
}
18
20
}
19
21
}
Original file line number Diff line number Diff line change @@ -7,6 +7,5 @@ pub fn load_env_var(name: &str) -> anyhow::Result<String> {
7
7
}
8
8
9
9
pub fn read_to_string < P : AsRef < Path > > ( path : P ) -> anyhow:: Result < String > {
10
- let error = format ! ( "Cannot read file {:?}" , path. as_ref( ) ) ;
11
- std:: fs:: read_to_string ( path) . context ( error)
10
+ std:: fs:: read_to_string ( & path) . with_context ( || format ! ( "Cannot read file {:?}" , path. as_ref( ) ) )
12
11
}
You can’t perform that action at this time.
0 commit comments