~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2009-04-07 11:51:05 UTC
  • mto: (4222.3.7 username)
  • mto: This revision was merged to the branch mainline in revision 4264.
  • Revision ID: jelmer@samba.org-20090407115105-r7tx90v1ejqijf6y
Review feedback from vila: cope with stdin.readline() returning None, fix consistency in tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
209
209
        """
210
210
        prompt += ': '
211
211
        self.prompt(prompt, **kwargs)
212
 
        return self.stdin.readline().rstrip("\n")
 
212
        username = self.stdin.readline()
 
213
        if not username:
 
214
            username = None
 
215
        elif username[-1] == '\n':
 
216
            username = username[:-1]
 
217
        return username
213
218
 
214
219
    def prompt(self, prompt, **kwargs):
215
220
        """Emit prompt on the CLI."""