mirror of
https://github.com/moparisthebest/pacman
synced 2025-03-01 01:41:52 -05:00
Fix broken output when asking question and stdin is piped
When asking question and stdin is piped, the response does not get printed out, resulting in a missing \n and broken output (FS#27909); printing the response fixes it. Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
4e60b9646d
commit
d9af1a0cf2
@ -1365,6 +1365,12 @@ static int question(short preset, char *fmt, va_list args)
|
||||
return preset;
|
||||
}
|
||||
|
||||
/* if stdin is piped, response does not get printed out, and as a result
|
||||
* a \n is missing, resulting in broken output (FS#27909) */
|
||||
if(!isatty(fileno(stdin))) {
|
||||
fprintf(stream, "%s\n", response);
|
||||
}
|
||||
|
||||
if(strcasecmp(response, _("Y")) == 0 || strcasecmp(response, _("YES")) == 0) {
|
||||
return 1;
|
||||
} else if(strcasecmp(response, _("N")) == 0 || strcasecmp(response, _("NO")) == 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user