I have some remote repositories (started with --bare) on a Linux Ubuntu machine (14.04 and 16.04). These repositories receive commits and from there the events of the hooks scripts begin deploying the applications. The script used by deploy is the post-receive.
I would, however, like this script to show the output to the client pushing the commit in real time and not just when the script is finished.
According to this response and this line, the buffer is apparently unloaded whenever a new line is written to the output by the script.
But I've tried this in several ways and none worked. I only get the response on the client that is pushing the commit when the script ends.
I've already tried:
#!/bin/bash
echo "A - Starting deploy. \n";
echo "A - Starting deploy. \n\r";
echo "A - Starting deploy. \r";
echo -e "A - Starting deploy. \n";
echo -e "A - Starting deploy. \n\r";
echo -e "A - Starting deploy. \r";
printf "A - Starting deploy. \n";
printf "A - Starting deploy. \n\r";
printf "A - Starting deploy. \r";
# Code for deploy ...
echo "B - Finished deploy.";
But all outputs, both "A" and "B" started, only appear on the client console when the entire script ends.
I would like each line to be presented to the client as the script executes.
I believe this is possible because I use the lib s3cmd to upload AWS S3 assets, and while it uploads, the outputs are shown in the execution, not just at the end, as shown below. It is also interesting that the outputs I wrote are sent in the response also when s3cmd starts sending its outputs.
Can someone help me?