From 09bc5b5787a763413cf3dec387fa6f3698798241 Mon Sep 17 00:00:00 2001 From: Gilles Carry Date: Thu, 24 Feb 2011 09:40:31 +0100 Subject: [PATCH] Use stderr instead of stdout to prompt password. --- src/ChangeLog | 10 ++++++++++ src/main.c | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) 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(""); } -- 2.39.2