mirror of
https://github.com/swaywm/sway.git
synced 2025-11-07 13:29:56 -05:00
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.
This commit is contained in:
parent
dbf8e1cead
commit
5c6f3d7266
6 changed files with 70 additions and 59 deletions
|
|
@ -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) {
|
||||
ipc_event_binding(binding);
|
||||
} else {
|
||||
wlr_log(WLR_DEBUG, "could not run command for binding: %s (%s)",
|
||||
binding->command, results->error);
|
||||
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);
|
||||
}
|
||||
|
||||
free_cmd_results(results);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue