Re: psql: default base and password reading

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>, Bradley McLean <brad(at)bradm(dot)net>, Adam Osuchowski <adwol(at)polsl(dot)gliwice(dot)pl>
Subject: Re: psql: default base and password reading
Date: 2001-10-13 17:14:32
Message-ID: 200110131714.f9DHEWA21586@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> >> On second thought --- are we creating any portability problems if we
> >> assume /dev/tty exists? In particular, what about the Windows port
> >> of psql? Will it still work?
>
> > I am sure cygwin takes care of this.
>
> Please recall that we have a *native* port of psql ... cygwin doesn't
> help.

OK, I read up on how BSD/OS does this and found getpass():

The getpass() function displays a prompt to, and reads in a password
from, /dev/tty. If this file is not accessible, getpass displays the
prompt on the standard error output and reads from the standard
input.

So even it tries for /dev/tty and falls back to stdin/stderr. The
attached patch does this.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

Attachment Content-Type Size
unknown_filename text/plain 6.4 KB

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Peter Eisentraut 2001-10-13 18:14:40 Re: psql: default base and password reading
Previous Message Bruce Momjian 2001-10-13 16:14:33 Re: psql: default base and password reading