setup.py 786 B

1234567891011121314151617181920212223
  1. import subprocess
  2. import sys
  3. import setup_util
  4. from os.path import expanduser
  5. import os
  6. home = expanduser("~")
  7. def start(args, logfile, errfile):
  8. try:
  9. subprocess.check_call("mvn clean package;", shell=True, cwd="dropwizard-mongodb", stderr=errfile, stdout=logfile)
  10. subprocess.Popen("java -jar target/dropwizard-mongodb-0.0.1-SNAPSHOT.jar server hello-world.yml", shell=True, cwd="dropwizard-mongodb", stderr=errfile, stdout=logfile)
  11. return 0
  12. except subprocess.CalledProcessError:
  13. return 1
  14. def stop(logfile, errfile):
  15. p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
  16. out, err = p.communicate()
  17. for line in out.splitlines():
  18. if 'hello-world' in line:
  19. pid = int(line.split(None, 2)[1])
  20. os.kill(pid, 15)
  21. return 0