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
and broken output (FS#27909); printing the response
fixes it.
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 2d88bac..0da86dd 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -1429,6 +1429,12 @@ static int question(short preset, char *fmt, va_list args)
if(len == 0) {
return preset;
}
+
+ /* if stdin is piped, response does not get printed out, and as a result
+ * a
is missing, resulting in broken output (FS#27909) */
+ if(!isatty(fileno(stdin))) {
+ fprintf(stream, "%s
", response);
+ }