setup.py 954 B

1234567891011121314151617181920212223242526272829303132
  1. import subprocess
  2. import sys
  3. import os
  4. def start(args, logfile, errfile):
  5. if os.name == 'nt':
  6. subprocess.check_call('"..\\sbt\\sbt.bat" ";start;shell"', shell=True, cwd="curacao", stderr=errfile, stdout=logfile)
  7. else:
  8. subprocess.check_call('../sbt/sbt ";start;shell"', shell=True, cwd="curacao", stderr=errfile, stdout=logfile)
  9. return 0
  10. def stop(logfile, errfile):
  11. if os.name == 'nt':
  12. subprocess.check_call("wmic process where \"CommandLine LIKE '%sbt-launch%'\" call terminate", stderr=errfile, stdout=logfile)
  13. else:
  14. p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
  15. out, err = p.communicate()
  16. for line in out.splitlines():
  17. if 'sbt-launch' in line:
  18. try:
  19. pid = int(line.split(None, 2)[1])
  20. os.kill(pid, 15)
  21. except OSError:
  22. pass
  23. return 0
  24. ##start([], open('log.out','a'), open('error.out','a'))
  25. ##stop(open('log.out','a'), open('error.out','a'))