Skip to content

Commit 76501c8

Browse files
committed
Make psql use pager only when it has a tty.
1 parent 3dd23aa commit 76501c8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/bin/psql/psql.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.84 1997/08/19 21:36:51 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.85 1997/08/22 00:17:26 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -157,7 +157,9 @@ slashUsage(PsqlSettings * ps)
157157
char *pagerenv;
158158
FILE *fout;
159159

160-
if ((pagerenv = getenv("PAGER")) && (pagerenv[0] != '\0') && \
160+
if (settings.notty == 0 &&
161+
(pagerenv = getenv("PAGER")) &&
162+
(pagerenv[0] != '\0') &&
161163
(fout = popen(pagerenv, "w")))
162164
{
163165
usePipe = 1;
@@ -1047,6 +1049,7 @@ do_help(const char *topic)
10471049
FILE *fout;
10481050

10491051
if (strcmp(topic, "*") == 0 &&
1052+
(settings.notty == 0) &&
10501053
(pagerenv = getenv("PAGER")) &&
10511054
(pagerenv[0] != '\0') &&
10521055
(fout = popen(pagerenv, "w")))

0 commit comments

Comments
 (0)