Rev 3850: Catch exceptions from pwd and raise a better error in http://bzr.arbash-meinel.com/branches/bzr/1.10-dev/catch_pwd_error
John Arbash Meinel
john at arbash-meinel.com
Tue Nov 25 17:19:45 GMT 2008
At http://bzr.arbash-meinel.com/branches/bzr/1.10-dev/catch_pwd_error
------------------------------------------------------------
revno: 3850
revision-id: john at arbash-meinel.com-20081125171926-ilhylvejbztofjex
parent: pqm at pqm.ubuntu.com-20081125152232-c22rycit2dfzm11f
author: Andrew Bennetts <andrew.bennetts at canonical.com>
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: catch_pwd_error
timestamp: Tue 2008-11-25 11:19:26 -0600
message:
Catch exceptions from pwd and raise a better error
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py 2008-10-16 18:30:32 +0000
+++ b/bzrlib/config.py 2008-11-25 17:19:26 +0000
@@ -839,7 +839,11 @@
try:
import pwd
uid = os.getuid()
- w = pwd.getpwuid(uid)
+ try:
+ w = pwd.getpwuid(uid)
+ except KeyError:
+ raise errors.BzrCommandError('Unable to determine your name. '
+ 'Please use "bzr whoami" to set it.')
# we try utf-8 first, because on many variants (like Linux),
# /etc/passwd "should" be in utf-8, and because it's unlikely to give
More information about the bazaar-commits
mailing list