setup.py 820 B

1234567891011121314151617181920212223242526272829
  1. import subprocess
  2. import sys
  3. import setup_util
  4. import os
  5. from os.path import expanduser
  6. home = expanduser("~")
  7. def start(args):
  8. subprocess.check_call("nimrod c -d:release --path:../installs/jester/jester hello.nim", shell=True, cwd="jester")
  9. subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/jester/config/nginx.conf", shell=True)
  10. subprocess.Popen("./hello > /dev/null", shell=True, cwd="jester")
  11. return 0
  12. def stop():
  13. subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True)
  14. p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
  15. out, err = p.communicate()
  16. for line in out.splitlines():
  17. if 'hello' in line:
  18. try:
  19. pid = int(line.split(None, 2)[1])
  20. os.kill(pid, 9)
  21. except OSError:
  22. pass
  23. return 0