allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [14/50] git commit: [#5603] update pgrep to not match self, rather than skipping last pid
Date Tue, 22 Jan 2013 23:23:18 GMT
[#5603] update pgrep to not match self, rather than skipping last pid


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/df1a971e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/df1a971e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/df1a971e

Branch: refs/heads/cj/4691
Commit: df1a971ebfb688939eb895301905b98fac9d32f0
Parents: 7c5e5a6
Author: Dave Brondsema <dbrondsema@geek.net>
Authored: Fri Jan 11 21:34:07 2013 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Mon Jan 21 21:31:23 2013 +0000

----------------------------------------------------------------------
 Allura/allura/command/taskd_cleanup.py |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/df1a971e/Allura/allura/command/taskd_cleanup.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/taskd_cleanup.py b/Allura/allura/command/taskd_cleanup.py
index c2bfee5..0951f8b 100644
--- a/Allura/allura/command/taskd_cleanup.py
+++ b/Allura/allura/command/taskd_cleanup.py
@@ -102,15 +102,14 @@ class TaskdCleanupCommand(base.Command):
         })
 
     def _taskd_pids(self):
-        p = subprocess.Popen(['pgrep', '-f', '/paster taskd'],
+        # space after "taskd" to ensure no match on taskd_cleanup (ourself)
+        p = subprocess.Popen(['pgrep', '-f', '/paster taskd '],
                 stdout=subprocess.PIPE,
                 stderr=subprocess.PIPE)
         stdout, stderr = p.communicate()
         tasks = []
         if p.returncode == 0:
-            # p.communicate() returns self-process too,
-            # so we need to skip last pid
-            tasks = [pid for pid in stdout.split('\n') if pid != ''][:-1]
+            tasks = [pid for pid in stdout.split('\n') if pid != '']
         return tasks
 
     def _taskd_status(self, pid, retry=False):


Mime
View raw message