From: Gilles Carry Date: Thu, 24 Feb 2011 08:40:31 +0000 (+0100) Subject: Use stderr instead of stdout to prompt password. X-Git-Tag: v1.13~69 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=09bc5b5787a763413cf3dec387fa6f3698798241 Use stderr instead of stdout to prompt password. --- diff --git a/src/ChangeLog b/src/ChangeLog index 7f79edb8..b421f264 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2011-02-22 Gilles Carry + + * 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 * http.c (gethttp, http_loop): Move duplicated code which is run diff --git a/src/main.c b/src/main.c index 81277c35..5941fefa 100644 --- a/src/main.c +++ b/src/main.c @@ -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(""); }