Browse Source

verify Space-saving efforts

Mike Smith 11 years ago
parent
commit
553a28a426
1 changed files with 7 additions and 8 deletions
  1. 7 8
      unfiltered/setup_unfiltered.py

+ 7 - 8
unfiltered/setup_unfiltered.py

@@ -8,13 +8,6 @@ def start(args, logfile, errfile):
   setup_util.replace_text("unfiltered/src/main/resources/application.conf", "jdbc:mysql:\/\/.*:3306", "jdbc:mysql://" + args.database_host + ":3306")
   setup_util.replace_text("unfiltered/src/main/resources/application.conf", "maxThreads = \\d+", "maxThreads = " + str(args.max_threads))
 
-  # Shamelessly stolen from stack overflow
-  try:
-    from subprocess import DEVNULL
-  except ImportError:
-    import os
-    DEVNULL = open(os.devnull, 'wb')
-
   subprocess.check_call("../sbt/sbt assembly", shell=True, cwd="unfiltered", stderr=errfile, stdout=logfile)
   subprocess.Popen("java -jar bench-assembly-1.0.0.jar", shell=True, cwd="unfiltered/target/scala-2.10", stderr=errfile, stdout=logfile)
 
@@ -25,6 +18,12 @@ def stop(logfile, errfile):
   for line in out.splitlines():
     if 'bench-assembly' in line or 'java' in line:
       pid = int(line.split(None, 2)[1])
-      os.kill(pid, 9)
+      os.kill(pid, 15)
+
+  # Takes up so much disk space
+  if os.name == 'nt':
+    subprocess.check_call("del /f /s /q target", shell=True, cwd="unfiltered", stderr=errfile, stdout=logfile)
+  else:
+    subprocess.check_call("rm -rf target", shell=True, cwd="unfiltered", stderr=errfile, stdout=logfile)
 
   return 0