summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pacman/util.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pacman/util.c b/src/pacman/util.c
index c6841e16..6d395bb1 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -54,6 +54,12 @@ extern int neednl;
/* gets the current screen column width */
int getcols()
{
+ if(!isatty(1)) {
+ /* We will default to 80 columns if we're not a tty
+ * this seems a fairly standard file width.
+ */
+ return 80;
+ }
#ifdef TIOCGSIZE
struct ttysize win;
if(ioctl(1, TIOCGSIZE, &win) == 0) {