def _try_run_as_postgres(self):
if platform.UNIX and os.getegid() == 0:
try:
import pwd
uid = pwd.getpwnam('postgres').pw_uid
os.seteuid(uid)
return True
except Exception as e:
sys.stderr.write("Failed run as postgres: {0}\n".format(e))
pass
return False
评论列表
文章目录