diff options
author | emersion <contact@emersion.fr> | 2018-11-28 09:26:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-28 09:26:47 +0100 |
commit | 048b96a56d3d3a817c7c63bce2f8226fffc88aa4 (patch) | |
tree | 13d0886bd0887aeaaa8d10b8c67ac63685544a8d /sway/commands | |
parent | 60e1fb547cc763310f4d28a10a0c82a936714b94 (diff) | |
parent | 5c6f3d7266ab0c63015715f12c8e15eb144311a2 (diff) | |
download | sway-048b96a56d3d3a817c7c63bce2f8226fffc88aa4.tar.xz |
Merge pull request #3204 from RedSoxFan/cmd-res-list
Change execute_command to return a list of results
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/bind.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sway/commands/bind.c b/sway/commands/bind.c index 08acbe7a..34881b0f 100644 --- a/sway/commands/bind.c +++ b/sway/commands/bind.c @@ -289,13 +289,20 @@ void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding) wlr_log(WLR_DEBUG, "running command for binding: %s", binding->command); config->handler_context.seat = seat; - struct cmd_results *results = execute_command(binding->command, NULL, NULL); - if (results->status == CMD_SUCCESS) { + list_t *res_list = execute_command(binding->command, NULL, NULL); + bool success = true; + while (res_list->length) { + struct cmd_results *results = res_list->items[0]; + if (results->status != CMD_SUCCESS) { + wlr_log(WLR_DEBUG, "could not run command for binding: %s (%s)", + binding->command, results->error); + success = false; + } + free_cmd_results(results); + list_del(res_list, 0); + } + list_free(res_list); + if (success) { ipc_event_binding(binding); - } else { - wlr_log(WLR_DEBUG, "could not run command for binding: %s (%s)", - binding->command, results->error); } - - free_cmd_results(results); } |