libpriv/output: Also quiet down progress if not tty

Teach the RpmOstreeOutput default handler to be nice to non-TTYs as
well, just like we did in #1225. We should look at somehow unifying this
with the code in `rpmostree-dbus-helpers.c`.

Closes: #1278
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon 2018-02-27 20:04:53 +00:00 committed by Atomic Bot
parent 80bd997212
commit f0910c2b5c

View File

@ -50,9 +50,10 @@ rpmostree_output_default_handler (RpmOstreeOutputType type,
case RPMOSTREE_OUTPUT_PROGRESS_PERCENT:
if (!console.locked)
glnx_console_lock (&console);
glnx_console_progress_text_percent (
((RpmOstreeOutputProgressPercent*)data)->text,
((RpmOstreeOutputProgressPercent*)data)->percentage);
RpmOstreeOutputProgressPercent *prog = data;
/* let's not spam stdout if it's not a tty; see dbus-helpers.c */
if (prog->percentage == 100 || console.is_tty)
glnx_console_progress_text_percent (prog->text, prog->percentage);
break;
case RPMOSTREE_OUTPUT_PROGRESS_N_ITEMS:
{