mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-10 17:21:34 +00:00
Better logging of failure in the task_logger (#2940)
* logging task_logger failure * format * clippy fxes * cleanup * address comments
This commit is contained in:
parent
f19a0e8d70
commit
d27d815d92
@ -64,10 +64,12 @@ async fn validate_libfuzzer(config: ValidationConfig) -> Result<()> {
|
||||
let libfuzzer = LibFuzzer::new(
|
||||
&config.target_exe,
|
||||
config.target_options.clone(),
|
||||
config.target_env.into_iter().collect(),
|
||||
config.target_env.iter().cloned().collect(),
|
||||
config
|
||||
.setup_folder
|
||||
.unwrap_or(config.target_exe.parent().unwrap().to_path_buf()),
|
||||
.clone()
|
||||
.or_else(|| config.target_exe.parent().map(|p| p.to_path_buf()))
|
||||
.expect("invalid target_exe"),
|
||||
None::<&PathBuf>,
|
||||
MachineIdentity {
|
||||
machine_id: Uuid::nil(),
|
||||
@ -103,10 +105,12 @@ async fn get_logs(config: ValidationConfig) -> Result<()> {
|
||||
let libfuzzer = LibFuzzer::new(
|
||||
&config.target_exe,
|
||||
config.target_options.clone(),
|
||||
config.target_env.into_iter().collect(),
|
||||
config.target_env.iter().cloned().collect(),
|
||||
config
|
||||
.setup_folder
|
||||
.unwrap_or(config.target_exe.parent().unwrap().to_path_buf()),
|
||||
.clone()
|
||||
.or_else(|| config.target_exe.parent().map(|p| p.to_path_buf()))
|
||||
.expect("invalid setup_folder"),
|
||||
None::<&PathBuf>,
|
||||
MachineIdentity {
|
||||
machine_id: Uuid::nil(),
|
||||
|
@ -422,8 +422,8 @@ impl TaskLogger {
|
||||
}) => break,
|
||||
Ok(c) => c,
|
||||
Err(e) => {
|
||||
error!("{}", e);
|
||||
break;
|
||||
error!("task logger failure {}", e);
|
||||
return Err(e);
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -440,7 +440,10 @@ pub struct SpawnedLogger {
|
||||
|
||||
impl SpawnedLogger {
|
||||
pub async fn flush_and_stop(self, timeout: Duration) -> Result<()> {
|
||||
let _ = tokio::time::timeout(timeout, self.logger_handle).await;
|
||||
if let Ok(Err(e)) = tokio::time::timeout(timeout, self.logger_handle).await {
|
||||
error!("failed to flush and stop task logger {}", e);
|
||||
return Err(e.into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user