Skip to content

Commit

Permalink
Fixed atexit for pid file.
Browse files Browse the repository at this point in the history
  • Loading branch information
yurivict committed May 15, 2015
1 parent 8508235 commit 435e11d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tiny_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ def do_daemonize(pid_file):
write_pid_file2(pid_file, pid)
sys.exit(0); # exit from second parent

def write_pid_file2(f, pid):
def write_pid_file2(fname, pid):
p = str(pid)
f = open(f, 'w')
f = open(fname, 'w')
f.write(p)
f.close()
atexit.register(os.remove, f)
atexit.register(os.remove, fname)

def write_pid_file(f):
write_pid_file2(f, os.getpid())
Expand Down

0 comments on commit 435e11d

Please sign in to comment.