Send a notification at the end of the run (fix #554)
This commit is contained in:
10
src/main.rs
10
src/main.rs
@@ -381,7 +381,15 @@ fn run() -> Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if post_command_failed || runner.report().data().iter().any(|(_, result)| result.failed()) {
|
let failed = post_command_failed || runner.report().data().iter().any(|(_, result)| result.failed());
|
||||||
|
terminal::notify_desktop(
|
||||||
|
format!(
|
||||||
|
"Topgrade finished {}",
|
||||||
|
if failed { "with errors" } else { "sucessfully" }
|
||||||
|
),
|
||||||
|
None,
|
||||||
|
);
|
||||||
|
if failed {
|
||||||
Err(StepFailed.into())
|
Err(StepFailed.into())
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -296,3 +296,7 @@ pub fn set_desktop_notifications(desktop_notifications: bool) {
|
|||||||
pub fn prompt_yesno(question: &str) -> Result<bool, io::Error> {
|
pub fn prompt_yesno(question: &str) -> Result<bool, io::Error> {
|
||||||
TERMINAL.lock().unwrap().prompt_yesno(question)
|
TERMINAL.lock().unwrap().prompt_yesno(question)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn notify_desktop<P: AsRef<str>>(message: P, timeout: Option<Duration>) {
|
||||||
|
TERMINAL.lock().unwrap().notify_desktop(message, timeout)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user