Issue
I'm trying to improve my CI tooling and to do so I'm trying to capture the output of the git clone command, and this is driving me crazy.
In order to simplify the scenario, I reduce the problem to this simple command:
git clone --progress https://github.com/$REPO.git $FOLDER 2>&1 | xargs echo -
With 2>&1
I'm redirecting the stderr (use by git to output the progress) to the stdout, then I'm trying to pipe that to xargs echo -
. In my real life scenario xargs echo
will be replaced by something else.
I'm using --progress in order to force git to be verbose even if it is not attached to a real console.
My expected output would be:
- Cloning into 'a3'...
- remote: Counting objects: 54130, done.
- remote: Compressing objects: 100% (520/520), done.
My output is instead absolutely nothing. I'm testing this on OSX 10.11.
Does anyone know what's wrong with that command?
Thank you very much in advance.
Solution
I solved it by using
git clone --progress --branch $TAG_VERSION https://github.com/$REPO ./ 2>&1 | tr '\u000D' '\n'"
Answered By - lucaconlaq Answer Checked By - Gilberto Lyons (WPSolving Admin)