Log notification script failures

jmap
Manos Pitsidianakis 2019-11-24 20:39:57 +02:00
parent db197aaffe
commit e5f5febd6b
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 10 additions and 3 deletions

View File

@ -145,14 +145,21 @@ impl Component for NotificationFilter {
fn process_event(&mut self, event: &mut UIEvent, context: &mut Context) -> bool {
if let UIEvent::Notification(ref title, ref body, ref kind) = event {
if let Some(ref bin) = context.runtime_settings.notifications.script {
if let Err(v) = Command::new(bin)
.arg(title.as_ref().map(String::as_str).unwrap_or("Event"))
if let Err(err) = Command::new(bin)
.arg(title.as_ref().map(String::as_str).unwrap_or("meli"))
.arg(body)
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.spawn()
{
debug!("{:?}", v);
log(
format!(
"Could not run notification script: {}.",
err.to_string()
),
ERROR,
);
debug!("{:?}", err);
}
}