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/ipc-server.c | |
parent | 60e1fb547cc763310f4d28a10a0c82a936714b94 (diff) | |
parent | 5c6f3d7266ab0c63015715f12c8e15eb144311a2 (diff) |
Merge pull request #3204 from RedSoxFan/cmd-res-list
Change execute_command to return a list of results
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r-- | sway/ipc-server.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index aa0f0fad..95433d97 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c @@ -597,13 +597,18 @@ void ipc_client_handle_command(struct ipc_client *client) { switch (client->current_command) { case IPC_COMMAND: { - struct cmd_results *results = execute_command(buf, NULL, NULL); + list_t *res_list = execute_command(buf, NULL, NULL); transaction_commit_dirty(); - char *json = cmd_results_to_json(results); + char *json = cmd_results_to_json(res_list); int length = strlen(json); client_valid = ipc_send_reply(client, json, (uint32_t)length); free(json); - free_cmd_results(results); + while (res_list->length) { + struct cmd_results *results = res_list->items[0]; + free_cmd_results(results); + list_del(res_list, 0); + } + list_free(res_list); goto exit_cleanup; } |