[Qbs] Get Git commit hash

Christian Kandeler christian.kandeler at qt.io
Mon Aug 14 10:24:17 CEST 2017


On Fri, 11 Aug 2017 21:28:41 +0200
Rémi Thébault <remi.thebault at gmail.com> wrote:

> > By the way, for retrieving the actual commit hash, wouldn't it make more
> > sense to simply run git, rather than parsing the metadata yourself?
>
> That was my first intention (using `git log --pretty=format:%h -n 1`). I
> took this path because Command only belongs to Rule.
> I later found out about qbs.Process, but I'm not able to use it correctly.
> proc.exec("git", ["log", "-n", "1"]) always return 128. proc.exec("git",
> []) returns 1 (what it should) however.

You should look at what proc.readStdErr() returns, then.


Christian



More information about the Qbs mailing list