File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ struct Host {
160
160
161
161
impl Metrics {
162
162
fn new ( sh : & Shell ) -> anyhow:: Result < Metrics > {
163
- let host = Host :: new ( sh) ? ;
163
+ let host = Host :: new ( sh) . unwrap_or_else ( |_| Host :: unknown ( ) ) ;
164
164
let timestamp = SystemTime :: now ( ) ;
165
165
let revision = cmd ! ( sh, "git rev-parse HEAD" ) . read ( ) ?;
166
166
let perf_revision = "a584462e145a0c04760fd9391daefb4f6bd13a99" . into ( ) ;
@@ -191,9 +191,13 @@ impl Metrics {
191
191
}
192
192
193
193
impl Host {
194
+ fn unknown ( ) -> Host {
195
+ Host { os : "unknown" . into ( ) , cpu : "unknown" . into ( ) , mem : "unknown" . into ( ) }
196
+ }
197
+
194
198
fn new ( sh : & Shell ) -> anyhow:: Result < Host > {
195
199
if cfg ! ( not( target_os = "linux" ) ) {
196
- return Ok ( Host { os : "unknown" . into ( ) , cpu : " unknown" . into ( ) , mem : "unknown" . into ( ) } ) ;
200
+ return Ok ( Host :: unknown ( ) ) ;
197
201
}
198
202
199
203
let os = read_field ( sh, "/etc/os-release" , "PRETTY_NAME=" ) ?. trim_matches ( '"' ) . to_owned ( ) ;
You can’t perform that action at this time.
0 commit comments