Browse Source

Changes to py2 process termination

Michael Robertson 12 years ago
parent
commit
7718be2aae
3 changed files with 20 additions and 10 deletions
  1. 6 5
      falcon/setup.py
  2. 6 5
      flask/setup.py
  3. 8 0
      flask/setup_nginxuwsgi.py

+ 6 - 5
falcon/setup.py

@@ -22,9 +22,10 @@ def start(args):
     return 0
 
 def stop():
-    global proc
-    if proc is None:
-        return 0
-    proc.terminate()
-    proc = None
+    p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
+    out, err = p.communicate()
+    for line in out.splitlines():
+      if 'FrameworkBenchmarks/installs/py2/bin/' in line:
+        pid = int(line.split(None,2)[1])
+        kill(pid, 9)
     return 0

+ 6 - 5
flask/setup.py

@@ -23,9 +23,10 @@ def start(args):
     return 0
 
 def stop():
-    global proc
-    if proc is None:
-        return 0
-    proc.terminate()
-    proc = None
+    p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
+    out, err = p.communicate()
+    for line in out.splitlines():
+      if 'FrameworkBenchmarks/installs/py2/bin/' in line:
+        pid = int(line.split(None,2)[1])
+        kill(pid, 9)
     return 0

+ 8 - 0
flask/setup_nginxuwsgi.py

@@ -24,4 +24,12 @@ def start(args):
 def stop():
     subprocess.call('sudo /usr/local/nginx/sbin/nginx -s stop', shell=True)
     subprocess.call(bin_dir + '/uwsgi --ini ' + config_dir + '/uwsgi_stop.ini', shell=True)
+
+    p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
+    out, err = p.communicate()
+    for line in out.splitlines():
+      if 'FrameworkBenchmarks/installs/py2/bin/' in line:
+        pid = int(line.split(None,2)[1])
+        kill(pid, 9)
+
     return 0