aboutsummaryrefslogtreecommitdiffstats
path: root/sway/main.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-11-27 21:42:09 -0500
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-11-27 21:42:09 -0500
commit5c6f3d7266ab0c63015715f12c8e15eb144311a2 (patch)
tree8a30abddb8380fc03d6f8674c469570fbf493327 /sway/main.c
parentMerge pull request #3175 from emersion/rename-gtk-primary-selection (diff)
downloadsway-5c6f3d7266ab0c63015715f12c8e15eb144311a2.tar.gz
sway-5c6f3d7266ab0c63015715f12c8e15eb144311a2.tar.zst
sway-5c6f3d7266ab0c63015715f12c8e15eb144311a2.zip
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.
Diffstat (limited to 'sway/main.c')
-rw-r--r--sway/main.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sway/main.c b/sway/main.c
index a21970e2..a74183fe 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -392,11 +392,16 @@ int main(int argc, char **argv) {
392 wlr_log(WLR_DEBUG, "Running deferred commands"); 392 wlr_log(WLR_DEBUG, "Running deferred commands");
393 while (config->cmd_queue->length) { 393 while (config->cmd_queue->length) {
394 char *line = config->cmd_queue->items[0]; 394 char *line = config->cmd_queue->items[0];
395 struct cmd_results *res = execute_command(line, NULL, NULL); 395 list_t *res_list = execute_command(line, NULL, NULL);
396 if (res->status != CMD_SUCCESS) { 396 while (res_list->length) {
397 wlr_log(WLR_ERROR, "Error on line '%s': %s", line, res->error); 397 struct cmd_results *res = res_list->items[0];
398 if (res->status != CMD_SUCCESS) {
399 wlr_log(WLR_ERROR, "Error on line '%s': %s", line, res->error);
400 }
401 free_cmd_results(res);
402 list_del(res_list, 0);
398 } 403 }
399 free_cmd_results(res); 404 list_free(res_list);
400 free(line); 405 free(line);
401 list_del(config->cmd_queue, 0); 406 list_del(config->cmd_queue, 0);
402 } 407 }