setup.py 585 B

1234567891011121314151617181920
  1. import subprocess
  2. import sys
  3. import setup_util
  4. import os
  5. def start(args):
  6. try:
  7. subprocess.check_call("mvn clean compile assembly:single", shell=True, cwd="netty")
  8. subprocess.Popen("java -jar netty-example-0.1-jar-with-dependencies.jar".rsplit(" "), cwd="netty/target")
  9. return 0
  10. except subprocess.CalledProcessError:
  11. return 1
  12. def stop():
  13. p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
  14. out, err = p.communicate()
  15. for line in out.splitlines():
  16. if 'netty-example' in line:
  17. pid = int(line.split(None, 2)[1])
  18. os.kill(pid, 9)
  19. return 0