cmdserver: using error channel for password prompt?

Matt Mackall mpm at selenic.com
Tue Jan 13 02:09:48 CST 2015


On Mon, 2015-01-12 at 14:21 -0700, MortenP wrote:
> Hi all
> Just discovered that the cmdserver problem with getting passwords from
> client has been fixed back in April. Nice!! I tried to use it with v3.2.3,
> but ran into a problem: for some reason the error channel is used for
> outputting the 'password:' prompt:
> 
> <o:62>[Username not specified in .hg/hgrc. Keyring will not be used.]
> <o:28>[http authorization required]
> <o:11>[realm: RTX]
> <o:5>[user:]
> <o:1>[ ]
> <L:4096>[]
> MHP                  // my input
> <L:4096>[]
> *<e:10>[password: ]*
...
>                 passwd = self.ui.getpass() 
> 
> I am not sure if this is by design, but it looks wrong to me. The prompt is
> not an error message. Note that I am not a Python savvy, so I might have
> missed something. Will someone take a look and let me know?

Python's getpass.getpass follows a fairly standard UNIX strategy of
first trying to write the prompt to /dev/tty (to make sure it isn't
redirected) and then trying sys.stderr (which cmdserver redirects to the
client). 

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list