mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-08 12:41:35 +00:00
performance-metrics: Use non-zero exit code on report file issues
This removes the need to wrap an error that is never used. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
f99c09fab7
commit
c922bf23f6
@ -22,10 +22,6 @@ enum Error {
|
|||||||
TestTimeout,
|
TestTimeout,
|
||||||
#[error("Error: test failed")]
|
#[error("Error: test failed")]
|
||||||
TestFailed,
|
TestFailed,
|
||||||
#[error("Error creating log file: {0}")]
|
|
||||||
ReportFileCreation(std::io::Error),
|
|
||||||
#[error("Error writing log file: {0}")]
|
|
||||||
ReportFileWrite(std::io::Error),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
@ -489,7 +485,10 @@ fn main() {
|
|||||||
if let Some(file) = cmd_arguments.value_of("report-file") {
|
if let Some(file) = cmd_arguments.value_of("report-file") {
|
||||||
Box::new(
|
Box::new(
|
||||||
std::fs::File::create(std::path::Path::new(file))
|
std::fs::File::create(std::path::Path::new(file))
|
||||||
.map_err(Error::ReportFileCreation)
|
.map_err(|e| {
|
||||||
|
eprintln!("Error opening report file: {}: {}", file, e);
|
||||||
|
std::process::exit(1);
|
||||||
|
})
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
@ -502,6 +501,9 @@ fn main() {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.as_bytes(),
|
.as_bytes(),
|
||||||
)
|
)
|
||||||
.map_err(Error::ReportFileWrite)
|
.map_err(|e| {
|
||||||
|
eprintln!("Error writing report file: {}", e);
|
||||||
|
std::process::exit(1);
|
||||||
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user