Delete notification file if server fails to start up
This commit is contained in:
parent
d67f330397
commit
736bd0c019
|
@ -382,6 +382,16 @@ async fn main_cli() -> Result<()> {
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
if let Err(e) = server.await {
|
if let Err(e) = server.await {
|
||||||
tracing::error!("failed to start up daemon: {e}");
|
tracing::error!("failed to start up daemon: {e}");
|
||||||
|
|
||||||
|
// Delete the notification file if it was created
|
||||||
|
if let Some(startup_notification_file_path) = args.startup_notification_file_path {
|
||||||
|
if File::metadata(startup_notification_file_path).await.is_ok() {
|
||||||
|
if let Err(e) = tokio::fs::remove_file(startup_notification_file_path).await {
|
||||||
|
tracing::error!("failed to remove stray startup notification file at {startup_notification_file_path:?}; you may need to delete it manually");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue