Add proper return code for i3-msg
This commit is contained in:
parent
e2d6117b8c
commit
72ccd341fc
|
@ -67,6 +67,7 @@ typedef struct reply_t {
|
|||
char *errorposition;
|
||||
} reply_t;
|
||||
|
||||
static int exit_code = 0;
|
||||
static reply_t last_reply;
|
||||
|
||||
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.error);
|
||||
exit_code = 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -326,5 +328,5 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
close(sockfd);
|
||||
|
||||
return 0;
|
||||
return exit_code;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
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
|
||||
|
||||
------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue