Exemple #1
0
 def console_output(self, targets):
   pidfiles_and_ports = ReportingServerManager.get_current_server_pidfiles_and_ports()
   if not pidfiles_and_ports:
     return ['No server found.']
   # There should only be one pidfile, but in case there are many, we kill them all here.
   for pidfile, port in pidfiles_and_ports:
     with open(pidfile, 'r') as infile:
       pidstr = infile.read()
     try:
       os.unlink(pidfile)
       pid = int(pidstr)
       os.kill(pid, signal.SIGKILL)
       return ['Killed server with pid %d at http://localhost:%d' % (pid, port)]
     except (ValueError, OSError):
       return []
Exemple #2
0
 def execute(self):
   pidfiles_and_ports = ReportingServerManager.get_current_server_pidfiles_and_ports()
   if not pidfiles_and_ports:
     print('No server found.', file=sys.stderr)
   # There should only be one pidfile, but in case there are many, we kill them all here.
   for pidfile, port in pidfiles_and_ports:
     with open(pidfile, 'r') as infile:
       pidstr = infile.read()
     try:
       os.unlink(pidfile)
       pid = int(pidstr)
       os.kill(pid, signal.SIGKILL)
       print('Killed server with pid %d at http://localhost:%d' % (pid, port), file=sys.stderr)
     except (ValueError, OSError):
       pass
Exemple #3
0
 def console_output(self, targets):
     pidfiles_and_ports = ReportingServerManager.get_current_server_pidfiles_and_ports(
     )
     if not pidfiles_and_ports:
         return ['No server found.']
     # There should only be one pidfile, but in case there are many, we kill them all here.
     for pidfile, port in pidfiles_and_ports:
         with open(pidfile, 'r') as infile:
             pidstr = infile.read()
         try:
             os.unlink(pidfile)
             pid = int(pidstr)
             os.kill(pid, signal.SIGKILL)
             return [
                 'Killed server with pid %d at http://localhost:%d' %
                 (pid, port)
             ]
         except (ValueError, OSError):
             return []