functions: avoid CR when progress bar is not enabled
authorJavier Viguera <javier.viguera@digi.com>
Thu Apr 07 11:52:23 2011 +0200 (2011-04-07)
changeset 2382cbd07f3dd6e3
parent 2381 0ca0f85a4b2a
child 2383 bb6e2df2427f
functions: avoid CR when progress bar is not enabled

Using CT-NG with progress bar disabled, still prints CR ('\r') characters
on the output. When you capture the output to a file as part of an
automated build, it shows extra empty lines.

For example:

------------------------------------------------------------
[INFO ] Performing some trivial sanity checks

[INFO ] Build started 20110404.113619

[INFO ] Building environment variables

[EXTRA] Preparing working directories

[EXTRA] Installing user-supplied crosstool-NG configuration
------------------------------------------------------------

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
scripts/functions
     1.1 --- a/scripts/functions	Wed Apr 06 22:30:57 2011 +0200
     1.2 +++ b/scripts/functions	Thu Apr 07 11:52:23 2011 +0200
     1.3 @@ -106,7 +106,7 @@
     1.4                printf "[%-5s]%*s%s%s\n" "${cur_L}" "${indent}" " " "${line}"
     1.5                if [ ${cur_l} -le ${max_level} ]; then
     1.6                    # Only print to console (fd #6) if log level is high enough.
     1.7 -                  printf "\r[%-5s]%*s%s%s\n" "${cur_L}" "${indent}" " " "${line}" >&6
     1.8 +                  printf "${CT_LOG_PROGRESS_BAR:+\r}[%-5s]%*s%s%s\n" "${cur_L}" "${indent}" " " "${line}" >&6
     1.9                fi
    1.10                if [ "${CT_LOG_PROGRESS_BAR}" = "y" ]; then
    1.11                    printf "\r[%02d:%02d] %s " $((SECONDS/60)) $((SECONDS%60)) "${_prog_bar[$((_prog_bar_cpt/10))]}" >&6