Commit Graph

3 Commits (5d4a93486423113737b64a836b8c5710cae46bcf)

Author SHA1 Message Date
Michael Stapelberg d7b11bde28 i3 --moreversion: use readlink /proc/$pid/exe instead of realpath(argv[0])
The latter is actually wrong. For example, when running i3
--moreversion, it will print $(pwd)/i3 instead of $(which i3). In my
previous tests, this coincidentally was the same.
2012-08-13 13:38:04 +02:00
Michael Stapelberg dbe406641f use errx() instead of err() for custom error message 2012-08-12 18:34:03 +02:00
Michael Stapelberg 1e49f1b08a Implement i3 --moreversion
From the code:

    Connects to i3 to find out the currently running version. Useful since it
    might be different from the version compiled into this binary (maybe the
    user didn’t correctly install i3 or forgot te restart it).

Here is an example output:

    $ ./i3 --moreversion
    Binary i3 version:  4.2-202-gb8e782c (2012-08-12, branch "next") © 2009-2012 Michael Stapelberg and contributors
    Running i3 version: 4.2-202-gb8e782c (2012-08-12, branch "next") (pid 14804)

    The i3 binary you just called: /home/michael/i3/i3
    RUNNING BINARY DIFFERENT FROM BINARY ON DISK!
    The i3 binary you are running: /home/michael/i3/i3

    $ i3 restart
    2012-08-12 15:05:28 - Additional arguments passed. Sending them as a command to i3.
    IPC: received EOF instead of reply

    $ ./i3 --moreversion
    Binary i3 version:  4.2-202-gb8e782c (2012-08-12, branch "next") © 2009-2012 Michael Stapelberg and contributors
    Running i3 version: 4.2-202-gb8e782c (2012-08-12, branch "next") (pid 14804)

    The i3 binary you just called: /home/michael/i3/i3
    The i3 binary you are running: /home/michael/i3/i3
2012-08-12 15:10:13 +02:00