~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Vincent Ladeuil
  • Date: 2011-06-16 18:34:26 UTC
  • mfrom: (5609.46.3 2.3.4-dev)
  • mto: This revision was merged to the branch mainline in revision 5980.
  • Revision ID: v.ladeuil+lp@free.fr-20110616183426-oj818x56zm7yzvb8
Merge 2.3 into trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
2381
2381
    except UnicodeDecodeError:
2382
2382
        raise errors.BzrError("Can't decode username as %s." % \
2383
2383
                user_encoding)
 
2384
    except ImportError, e:
 
2385
        if sys.platform != 'win32':
 
2386
            raise
 
2387
        if str(e) != 'No module named pwd':
 
2388
            raise
 
2389
        # https://bugs.launchpad.net/bzr/+bug/660174
 
2390
        # getpass.getuser() is unable to return username on Windows
 
2391
        # if there is no USERNAME environment variable set.
 
2392
        # That could be true if bzr is running as a service,
 
2393
        # e.g. running `bzr serve` as a service on Windows.
 
2394
        # We should not fail with traceback in this case.
 
2395
        username = u'UNKNOWN'
2384
2396
    return username
2385
2397
 
2386
2398