diff options
author | Alexander Nestorov <alexandernst@gmail.com> | 2014-09-20 15:20:19 +0200 |
---|---|---|
committer | Alexander Nestorov <alexandernst@gmail.com> | 2014-09-20 15:20:19 +0200 |
commit | 4bc6b19c32cc83c163c3d85532c02c721e9183da (patch) | |
tree | 892de975c86e46f1f8b0c9db4d1525ec3aac63d8 /GitAutoDeploy.py | |
parent | cdf85bb48a08df9d7ed3f3063a87fbde67b151bd (diff) | |
download | Git-Auto-Deploy-4bc6b19c32cc83c163c3d85532c02c721e9183da.zip Git-Auto-Deploy-4bc6b19c32cc83c163c3d85532c02c721e9183da.tar.gz Git-Auto-Deploy-4bc6b19c32cc83c163c3d85532c02c721e9183da.tar.bz2 |
Close pid file after RW
Diffstat (limited to 'GitAutoDeploy.py')
-rwxr-xr-x | GitAutoDeploy.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/GitAutoDeploy.py b/GitAutoDeploy.py index fccd6bb..c917d64 100755 --- a/GitAutoDeploy.py +++ b/GitAutoDeploy.py @@ -138,15 +138,12 @@ class GitAutoDeployMain: sys.exit(1) def create_pidfile(self): - mainpid = os.getpid() - f = open(GitAutoDeploy.getConfig()['pidfilepath'], 'w') - f.write(str(mainpid)) - f.close() + with open(GitAutoDeploy.getConfig()['pidfilepath'], 'w') as f: + f.write(str(os.getpid())) def read_pidfile(self): - f = open(GitAutoDeploy.getConfig()['pidfilepath'],'r') - pid = f.readlines() - return pid + with open(GitAutoDeploy.getConfig()['pidfilepath'],'r') as f: + return f.readlines() def remove_pidfile(self): os.remove(GitAutoDeploy.getConfig()['pidfilepath']) |