[FIX] pwd module does not exist on non posix platform (win32).
bzr revid: jth@openerp.com-20101013135707-zt73h89o6du3dpvy
This commit is contained in:
parent
092c4dff88
commit
0664e7e05f
|
@ -35,7 +35,6 @@ GNU Public Licence.
|
|||
#----------------------------------------------------------
|
||||
import logging
|
||||
import os
|
||||
import pwd
|
||||
import signal
|
||||
import sys
|
||||
import threading
|
||||
|
@ -45,11 +44,13 @@ import release
|
|||
__author__ = release.author
|
||||
__version__ = release.version
|
||||
|
||||
# We DON't log this using the standard logger, because we might mess
|
||||
# with the logfile's permissions. Just do a quick exit here.
|
||||
if pwd.getpwuid(os.getuid())[0] == 'root' :
|
||||
sys.stderr.write("Attempted to run OpenERP server as root. This is not good, aborting.\n")
|
||||
sys.exit(1)
|
||||
if os.name == 'posix':
|
||||
import pwd
|
||||
# We DON't log this using the standard logger, because we might mess
|
||||
# with the logfile's permissions. Just do a quick exit here.
|
||||
if pwd.getpwuid(os.getuid())[0] == 'root' :
|
||||
sys.stderr.write("Attempted to run OpenERP server as root. This is not good, aborting.\n")
|
||||
sys.exit(1)
|
||||
|
||||
#----------------------------------------------------------
|
||||
# get logger
|
||||
|
|
Loading…
Reference in New Issue