projects
/
skytools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d488602
)
BaseScript: write pidfile atomically to avoid corrupt pidfiles.
author
Marko Kreen
<markokr@gmail.com>
Fri, 15 Jun 2012 13:50:35 +0000
(16:50 +0300)
committer
Marko Kreen
<markokr@gmail.com>
Fri, 15 Jun 2012 13:50:35 +0000
(16:50 +0300)
python/skytools/scripting.py
patch
|
blob
|
blame
|
history
diff --git
a/python/skytools/scripting.py
b/python/skytools/scripting.py
index c7791dbc07cedb5a00ebe6d5289456005b6b406a..61b4aa6a7be425b344d0a0fbcc4cc6a2dff9b7f1 100644
(file)
--- a/
python/skytools/scripting.py
+++ b/
python/skytools/scripting.py
@@
-72,10
+72,9
@@
def run_single_process(runnable, daemon, pidfile):
try:
if pidfile:
- f = open(pidfile, 'w')
+ data = str(os.getpid())
+ skytools.write_atomic(pidfile, data)
own_pidfile = True
- f.write(str(os.getpid()))
- f.close()
runnable.run()
finally: