Boost logo

Boost-Build :

Subject: Re: [Boost-build] Unexpected line feed when capturing shell output
From: Martin Dyring-Andersen (mda_at_[hidden])
Date: 2015-09-20 10:38:10


Hi Volodya,

Thank you, that was exactly the kind of “cleaner” solution I was looking for. Would be great to get documented for future reference ☺

local GIT_BRANCH = [ SHELL "git rev-parse --abbrev-ref HEAD" : strip-eol ] ;
local GIT_HEAD = [ SHELL "git rev-parse --short HEAD" : strip-eol ] ;

echo "Git branch $(GIT_BRANCH) @ $(GIT_HEAD)" ;

Outputs:

Git branch develop @ 77f43d5

BR,
Martin

From: Boost-build [mailto:boost-build-bounces_at_[hidden]] On Behalf Of Vladimir Prus
Sent: 20. september 2015 03:05
To: Boost.Build developer's and user's list <boost-build_at_[hidden]>
Subject: Re: [Boost-build] Unexpected line feed when capturing shell output

Could you try:

    local GIT_BRANCH = [ SHELL "git rev-parse --abbrev-head HEAD" : strip-eol ] ;

I'll get this documented.

- Volodya


On Sun, Sep 20, 2015 at 12:57 AM Martin Dyring-Andersen <mda_at_[hidden]<mailto:mda_at_[hidden]>> wrote:
Hi Brian,

> maybe?
> echo -n `git rev-parse --abbrev-ref HEAD`
>
> It works on cmd line, not sure about within jam file...

I ended up with this, which seems to work as expected.. Thanks for pointing me in right direction, I thought it was a bug that linefeed was captured.

local GIT_BRANCH = [ SHELL "git rev-parse --abbrev-ref HEAD | tr -d '\n'" ] ;
echo "before$(GIT_BRANCH)after" ;

BR,
Martin
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build



Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk