]> sjero.net Git - wget/commitdiff
Use stderr instead of stdout to prompt password.
authorGilles Carry <gilles.carry@st.com>
Thu, 24 Feb 2011 08:40:31 +0000 (09:40 +0100)
committerGiuseppe Scrivano <gscrivano@gnu.org>
Thu, 24 Feb 2011 08:40:31 +0000 (09:40 +0100)
src/ChangeLog
src/main.c

index 7f79edb8b47115ab5890d1cd49b07e456b3759c1..b421f2645720d33892ba1078632d720c56d533cc 100644 (file)
@@ -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 -
+
 2011-02-22  Steven Schubiger  <stsc@member.fsf.org>
 
        * http.c (gethttp, http_loop): Move duplicated code which is run
index 81277c35742b63c474937b00e43f528f68d814db..5941fefad78810f230ba9e3d07ea9446e11cdff8 100644 (file)
@@ -740,9 +740,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("");
 }