Skip to content
Permalink
Browse files

Add proper return code for i3-msg

  • Loading branch information...
NilsIrl committed Feb 9, 2019
1 parent e2d6117 commit 72ccd341fc07476137fea00d67cf7a61d3c99098
Showing with 12 additions and 1 deletion.
  1. +3 −1 i3-msg/main.c
  2. +9 −0 man/i3-msg.man
@@ -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

------------------------------------------------

0 comments on commit 72ccd34

Please sign in to comment.
You can’t perform that action at this time.