From 5c6f3d7266ab0c63015715f12c8e15eb144311a2 Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Tue, 27 Nov 2018 21:42:09 -0500 Subject: Change execute_command to return a list of results This matches i3's behavior of returning a list of results that contain the result of each command that was executed. Additionally, the `parse_error` attribute has been added to the IPC JSON reply. --- sway/commands/bind.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'sway/commands') 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); } -- cgit v1.2.3