This commit is contained in:
Tobias Stoeckmann 2022-12-07 19:46:29 +01:00 committed by GitHub
commit df9b88befb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 131 additions and 86 deletions

View file

@ -550,8 +550,16 @@ int main(int argc, char **argv) {
int socketfd = ipc_open_socket(socket_path);
struct timeval timeout = {.tv_sec = 3, .tv_usec = 0};
ipc_set_recv_timeout(socketfd, timeout);
uint32_t len = strlen(command);
size_t len = strlen(command);
char *resp = ipc_single_command(socketfd, type, command, &len);
if (resp == NULL) {
if (!quiet) {
sway_log(SWAY_ERROR, "Failed to receive reply");
}
close(socketfd);
free(socket_path);
return 1;
}
// pretty print the json
json_tokener *tok = json_tokener_new_ex(JSON_MAX_DEPTH);