Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Gracefully handle and report failure to reload config #49

Merged
merged 3 commits into from
Jun 18, 2018

Conversation

vilhalmer
Copy link
Collaborator

@vilhalmer vilhalmer commented Jun 15, 2018

  • Don't overwrite the config when reloading until it has been fully parsed (woo!)
  • Make reload_config return a boolean
  • Report the success or failure of reload over DBus
  • Print a failure message and set the exit code of makoctl appropriately

Fixes #44.

config.c Outdated
wl_list_for_each_safe(criteria, tmp, &new_config.criteria, link) {
wl_list_remove(&criteria->link);
wl_list_insert(config->criteria.prev, &criteria->link);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little gross, but I thought it was worth it to avoid just doing the parsing again. That is an alternative, however.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think you can do it with wl_list_insert_list

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, I forgot that was there.

dbus/mako.c Outdated
}

static const sd_bus_vtable service_vtable[] = {
SD_BUS_VTABLE_START(0),
SD_BUS_METHOD("DismissAllNotifications", "", "", handle_dismiss_all_notifications, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("DismissLastNotification", "", "", handle_dismiss_last_notification, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("InvokeAction", "s", "", handle_invoke_action, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("Reload", "", "", handle_reload, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("Reload", "", "b", handle_reload, SD_BUS_VTABLE_UNPRIVILEGED),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to use dbus errors instead of return values?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know those existed, but probably!

Copy link
Owner

@emersion emersion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@emersion emersion merged commit 24f82c3 into emersion:master Jun 18, 2018
@emersion
Copy link
Owner

Thanks!

@vilhalmer vilhalmer deleted the makoctl-reload-failure-exit-code branch October 14, 2018 17:14
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants