Add proper return code for i3-msg

This commit is contained in:
Nils ANDRÉ-CHANG 2019-02-09 14:22:08 +00:00
parent e2d6117b8c
commit 72ccd341fc
2 changed files with 12 additions and 1 deletions

View File

@ -67,6 +67,7 @@ typedef struct reply_t {
char *errorposition; char *errorposition;
} reply_t; } reply_t;
static int exit_code = 0;
static reply_t last_reply; static reply_t last_reply;
static int reply_boolean_cb(void *params, int val) { static int reply_boolean_cb(void *params, int val) {
@ -100,6 +101,7 @@ static int reply_end_map_cb(void *params) {
fprintf(stderr, "ERROR: %s\n", last_reply.errorposition); fprintf(stderr, "ERROR: %s\n", last_reply.errorposition);
} }
fprintf(stderr, "ERROR: %s\n", last_reply.error); fprintf(stderr, "ERROR: %s\n", last_reply.error);
exit_code = 2;
} }
return 1; return 1;
} }
@ -326,5 +328,5 @@ int main(int argc, char *argv[]) {
close(sockfd); close(sockfd);
return 0; return exit_code;
} }

View File

@ -90,6 +90,15 @@ See the -m option for continuous monitoring.
i3-msg is a sample implementation for a client using the unix socket IPC i3-msg is a sample implementation for a client using the unix socket IPC
interface to i3. interface to i3.
=== Exit status:
0:
if OK,
1:
if invalid syntax or unable to connect to ipc-socket
2:
if i3 returned an error processing your command(s)
== EXAMPLES == EXAMPLES
------------------------------------------------ ------------------------------------------------