Hello Gilles, thanks for your patch. I am not sure it is a good idea to use stderr to prompt a message to the user. I would just inhibit the message when -O- is used.
Cheers, Giuseppe Gilles Carry <gilles.ca...@st.com> writes: > Hello, > > Here is a small patch to change the ask-password behaviour. > You may find the explanation in patch's changelog. > I confess I did not test much this patch. > > Best regards, > Thank-you, > Gilles. > > diff --git a/src/ChangeLog b/src/ChangeLog > index f37814d..b9bf2d7 100644 > --- a/src/ChangeLog > +++ b/src/ChangeLog > @@ -1,3 +1,13 @@ > +2011-02-22 Gilles Carry <gilles dot carry at st dot com> > + > + * main.c (prompt_for_password): Use stderr instead of stdout > + to prompt password. This allows to use --output-document=- and > + --ask-password simultaneously. Without this, redirecting stdout > + makes password prompt invisible and mucks up payload such as in > + this example: > + wget --output-document=- --ask-password -user=foo \ > + http://foo.com/tarball.tgz | tar zxf - > + > 2009-09-22 Micah Cowan <mi...@cowan.name> > > * openssl.c (ssl_check_certificate): Avoid reusing the same buffer > diff --git a/src/main.c b/src/main.c > index dddc4b2..db1638f 100644 > --- a/src/main.c > +++ b/src/main.c > @@ -725,9 +725,9 @@ static char * > prompt_for_password (void) > { > if (opt.user) > - printf (_("Password for user %s: "), quote (opt.user)); > + fprintf (stderr, _("Password for user %s: "), quote (opt.user)); > else > - printf (_("Password: ")); > + fprintf (stderr, _("Password: ")); > return getpass(""); > } >