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
13
sway/main.c
13
sway/main.c
|
|
@ -392,11 +392,16 @@ int main(int argc, char **argv) {
|
|||
wlr_log(WLR_DEBUG, "Running deferred commands");
|
||||
while (config->cmd_queue->length) {
|
||||
char *line = config->cmd_queue->items[0];
|
||||
struct cmd_results *res = execute_command(line, NULL, NULL);
|
||||
if (res->status != CMD_SUCCESS) {
|
||||
wlr_log(WLR_ERROR, "Error on line '%s': %s", line, res->error);
|
||||
list_t *res_list = execute_command(line, NULL, NULL);
|
||||
while (res_list->length) {
|
||||
struct cmd_results *res = res_list->items[0];
|
||||
if (res->status != CMD_SUCCESS) {
|
||||
wlr_log(WLR_ERROR, "Error on line '%s': %s", line, res->error);
|
||||
}
|
||||
free_cmd_results(res);
|
||||
list_del(res_list, 0);
|
||||
}
|
||||
free_cmd_results(res);
|
||||
list_free(res_list);
|
||||
free(line);
|
||||
list_del(config->cmd_queue, 0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue