Skip to content

Commit

Permalink
Add pragma: nocover before os._exit/os.execve
Browse files Browse the repository at this point in the history
Because coverage writes the collected information in an atexit hook, and
those are not run by os._exit()/os.execve().

There's not much code between os.fork() and os._exit()/os.execve().
Some of it is tested; some probably isn't.
  • Loading branch information
mgedmin committed Apr 15, 2015
1 parent 3f4220c commit 37cdbee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/zdaemon/zdrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def spawn(self):

self.options.logger.info("spawned process pid=%d" % pid)
return pid
else:
else: # pragma: nocover
# Child
try:
# Close file descriptors except std{in,out,err}.
Expand Down Expand Up @@ -347,7 +347,7 @@ def daemonize(self):
# http://www.hawklord.uklinux.net/system/daemons/d3.htm

pid = os.fork()
if pid != 0:
if pid != 0: # pragma: nocover
# Parent
self.logger.debug("daemon manager forked; parent exiting")
os._exit(0)
Expand Down

0 comments on commit 37cdbee

Please sign in to comment.