Disable progress bar on dumb terminals by default
The progress bar requires the terminal emulator to support ANSI escape sequences. Normally, TERM is set to dumb to indicate that the terminal emulator doesn't support any ANSI escape sequences. Attempting to use ANSI escape sequences on dumb terminals will lead to weird output. In order to make apk work by default, even on dumb terminals, this commit introduces an additional check which consults $TERM and disables the progress bar if it is set to "dumb".cute-signatures
parent
1456296b43
commit
429e5984c5
|
@ -368,7 +368,10 @@ static void setup_automatic_flags(struct apk_ctx *ac)
|
||||||
!isatty(STDIN_FILENO))
|
!isatty(STDIN_FILENO))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ac->progress.out = &ac->out;
|
/* Enable progress bar by default, except on dumb terminals. */
|
||||||
|
if (!(tmp = getenv("TERM")) || strcmp(tmp, "dumb") != 0)
|
||||||
|
ac->progress.out = &ac->out;
|
||||||
|
|
||||||
if (!(ac->flags & APK_SIMULATE) &&
|
if (!(ac->flags & APK_SIMULATE) &&
|
||||||
access("/etc/apk/interactive", F_OK) == 0)
|
access("/etc/apk/interactive", F_OK) == 0)
|
||||||
ac->flags |= APK_INTERACTIVE;
|
ac->flags |= APK_INTERACTIVE;
|
||||||
|
|
Loading…
Reference in New Issue