def _setgroup(group):
''' Normalizes group to a gid and sets the current gid, or does
nothing if group is None.
'''
if group is None:
return
# Normalize group to gid
elif isinstance(group, str):
gid = grp.getgrnam(group).gr_gid
# The group is already a gid.
else:
gid = group
try:
os.setgid(gid)
except OSError:
self.logger.error('Unable to change group.')
sys.exit(1)
评论列表
文章目录