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  <[email protected]>
 
        * 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("");
 }
 

Reply via email to