Use stderr instead of stdout in login command.

This is consistent with old password prompts (see #1600), and also makes
it so that everyone who calls `doInteractivePasswordLogin` is using the
same stream as `doInteractivePasswordLogin`.
This commit is contained in:
Emily Stark
2014-02-08 16:21:42 -08:00
parent 1d391ee7a9
commit 38734b94e6

View File

@@ -456,7 +456,8 @@ var doInteractivePasswordLogin = function (options) {
while (true) { while (true) {
loginData.password = utils.readLine({ loginData.password = utils.readLine({
echo: false, echo: false,
prompt: "Password: " prompt: "Password: ",
stream: process.stderr
}); });
try { try {
@@ -511,9 +512,15 @@ exports.loginCommand = function (options) {
var loginOptions = {}; var loginOptions = {};
if (options.email) { if (options.email) {
loginOptions.email = utils.readLine({ prompt: "Email: " }); loginOptions.email = utils.readLine({
prompt: "Email: ",
stream: process.stderr
});
} else { } else {
loginOptions.username = utils.readLine({ prompt: "Username: " }); loginOptions.username = utils.readLine({
prompt: "Username: ",
stream: process.stderr
});
} }
if (! doInteractivePasswordLogin(loginOptions)) { if (! doInteractivePasswordLogin(loginOptions)) {
@@ -527,17 +534,17 @@ exports.loginCommand = function (options) {
var galaxyLoginResult = logInToGalaxy(galaxy); var galaxyLoginResult = logInToGalaxy(galaxy);
if (galaxyLoginResult.error) { if (galaxyLoginResult.error) {
// XXX add human readable error messages // XXX add human readable error messages
process.stdout.write('\nLogin to ' + galaxy + ' failed. '); process.stderr.write('\nLogin to ' + galaxy + ' failed. ');
if (galaxyLoginResult.error === 'unauthorized') { if (galaxyLoginResult.error === 'unauthorized') {
process.stdout.write('You are not authorized for this galaxy.\n'); process.stderr.write('You are not authorized for this galaxy.\n');
} else if (galaxyLoginResult.error === 'no_oauth_server') { } else if (galaxyLoginResult.error === 'no_oauth_server') {
process.stdout.write('The galaxy could not ' + process.stderr.write('The galaxy could not ' +
'contact Meteor Accounts.\n'); 'contact Meteor Accounts.\n');
} else if (galaxyLoginResult.error === 'no_identity') { } else if (galaxyLoginResult.error === 'no_identity') {
process.stdout.write('Your login information could not be found.\n'); process.stderr.write('Your login information could not be found.\n');
} else { } else {
process.stdout.write('Error: ' + galaxyLoginResult.error + '\n'); process.stderr.write('Error: ' + galaxyLoginResult.error + '\n');
} }
return 1; return 1;
@@ -553,7 +560,7 @@ exports.loginCommand = function (options) {
tryRevokeOldTokens({ firstTry: true }); tryRevokeOldTokens({ firstTry: true });
data = readSessionData(); data = readSessionData();
process.stdout.write("\nLogged in" + (galaxy ? " to " + galaxy : "") + process.stderr.write("\nLogged in" + (galaxy ? " to " + galaxy : "") +
(currentUsername(data) ? (currentUsername(data) ?
" as " + currentUsername(data) : "") + ".\n" + " as " + currentUsername(data) : "") + ".\n" +
"Thanks for being a Meteor developer!\n"); "Thanks for being a Meteor developer!\n");