[pacman-dev] [PATCH 1/8] pacman: Make sure delayed warnings/errors are shown the same
Allan McRae
allan at archlinux.org
Sun Dec 15 05:31:47 EST 2013
On 03/12/13 06:45, Olivier Brunel wrote:
> When delayed until after a progress operation, they wouldn't be in colors,
> and be sent to stdout instead of stderr.
>
> Signed-off-by: Olivier Brunel <jjk at jjacky.com>
> ---
I had submitted a patch to deal with the color a couple of weeks
beforehand [1] which has now been pushed to master.
[1]
https://mailman.archlinux.org/pipermail/pacman-dev/2013-November/018241.html
So that part is no longer needed.
> src/pacman/callback.c | 2 +-
> src/pacman/util.c | 6 ++++--
> 2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/pacman/callback.c b/src/pacman/callback.c
> index a181fa5..c412f6f 100644
> --- a/src/pacman/callback.c
> +++ b/src/pacman/callback.c
> @@ -529,7 +529,7 @@ void cb_progress(alpm_progress_t event, const char *pkgname, int percent,
> alpm_list_t *i = NULL;
> on_progress = 0;
> for(i = output; i; i = i->next) {
> - fputs((const char *)i->data, stdout);
> + fputs((const char *)i->data, stderr);
> }
> fflush(stdout);
I guess we want the fflush(stdout) to happen before the outputting to
stderr here, and probably an fflush(stderr) afterwards.
> FREELIST(output);
> diff --git a/src/pacman/util.c b/src/pacman/util.c
> index 23eea98..4877cc3 100644
> --- a/src/pacman/util.c
> +++ b/src/pacman/util.c
> @@ -1593,10 +1593,12 @@ int pm_vasprintf(char **string, alpm_loglevel_t level, const char *format, va_li
> /* print a prefix to the message */
> switch(level) {
> case ALPM_LOG_ERROR:
> - pm_asprintf(string, _("error: %s"), msg);
> + pm_asprintf(string, "%s%s%s%s", config->colstr.err, _("error: "),
> + config->colstr.nocolor, msg);
> break;
> case ALPM_LOG_WARNING:
> - pm_asprintf(string, _("warning: %s"), msg);
> + pm_asprintf(string, "%s%s%s%s", config->colstr.warn, _("warning: "),
> + config->colstr.nocolor, msg);
> break;
> case ALPM_LOG_DEBUG:
> pm_asprintf(string, "debug: %s", msg);
>
More information about the pacman-dev
mailing list