Keep original exception when PID file creation fails

This commit is contained in:
Unrud 2017-05-07 21:55:59 +02:00
parent 79bcedd4bc
commit 65c53df5b3

View File

@ -123,9 +123,9 @@ def daemonize(configuration, logger):
pid_fd = os.open( pid_fd = os.open(
configuration.get("server", "pid"), configuration.get("server", "pid"),
os.O_CREAT | os.O_EXCL | os.O_WRONLY) os.O_CREAT | os.O_EXCL | os.O_WRONLY)
except: except OSError as e:
raise OSError( raise OSError("PID file exists: %s" %
"PID file exists: %s" % configuration.get("server", "pid")) configuration.get("server", "pid")) from e
pid = os.fork() pid = os.fork()
if pid: if pid:
sys.exit() sys.exit()