Skip to content
Snippets Groups Projects
Commit b5b130e1 authored by Timo Teräs's avatar Timo Teräs
Browse files

print: flush after progress notice if needed

fixes commit 4c776eb7 db: make index refresh notices a progress note
parent 10b467c0
No related branches found
No related tags found
No related merge requests found
......@@ -38,8 +38,10 @@ void apk_url_parse(struct apk_url_print *, const char *);
#define URL_PRINTF(u) (int)u.len_before_pw, u.url, u.pwmask, u.url_or_host
struct apk_out {
int verbosity, progress_disable, progress_fd;
int verbosity, progress_fd;
unsigned int width;
unsigned int progress_disable : 1;
unsigned int need_flush : 1;
const char *progress_char;
FILE *out, *err, *log;
struct apk_progress *prog;
......
......@@ -198,6 +198,7 @@ static void apk_out_render_progress(struct apk_out *out, bool force)
for (; i < bar_width; i++) fputc(' ', f);
fflush(f);
fputs("\e8\e[0K", f);
out->need_flush = 1;
}
}
......@@ -225,6 +226,7 @@ void apk_out_progress_note(struct apk_out *out, const char *format, ...)
fprintf(f, "\e7[%s]", buf);
fflush(f);
fputs("\e8\e[0K", f);
out->need_flush = 1;
}
void apk_out_fmt(struct apk_out *out, const char *prefix, const char *format, ...)
......@@ -232,8 +234,9 @@ void apk_out_fmt(struct apk_out *out, const char *prefix, const char *format, ..
va_list va;
if (prefix != APK_OUT_LOG_ONLY) {
va_start(va, format);
if (prefix && out->prog) fflush(out->out);
if (prefix && out->need_flush) fflush(out->out);
log_internal(prefix ? out->err : out->out, prefix, format, va);
out->need_flush = 0;
va_end(va);
apk_out_render_progress(out, true);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment