Don't try asking for username/password when input is not a terminal
Review Request #7956 — Created Feb. 11, 2016 and submitted — Latest diff uploaded
This fixes a mysterious "hang" when running rbt using native Windows Python in
a Cygwin terminal emulator such as MinTTY: in this case, password entry doesn't
work correctly and even the prompt is not displayed.
I'm submitting this after wasting half an hour trying to diagnose the problem with "rbt post hanging" before realizing what it was really due to. This may seem to be an unusual case, but it's not the first time I run into it and IMHO it can't make things worse.
Also a question: there is very similar code in
utils/users.pywhich I didn't modify as I don't quite understand when exactly it is used and so couldn't test it. But it probably should be modified in the same way, shouldn't it? Or, perhaps, it could be refactored to reuse the same code in both places?
Ran it from a "normal" DOS window and from MinTTY and got the expected prompt in the former case and the expected error in the latter.