Exemple #1
0
	def start(self):
	    """Start Safari"""
	    if sys.platform == 'darwin':
	        self.set_proxy_mac()
	    elif sys.platform in ('cygwin', 'win32'):
	        self.set_proxy_windows()
	    # Workaround for bug in nose
	    if hasattr(sys.stdout, 'fileno'):
	        kwargs = {'stdout':sys.stdout ,'stderr':sys.stderr, 'stdin':sys.stdin}
	    else:
	        kwargs = {'stdout':sys.__stdout__ ,'stderr':sys.__stderr__, 'stdin':sys.stdin}
	    self.p_handle = killableprocess.runCommand([self.safari_binary, self.redirection_page], **kwargs)
	    logger.info([self.safari_binary, self.redirection_page])
Exemple #2
0
def get_pids(name, minimun_pid=0):
    """Get all the pids matching name, exclude any pids below minimum_pid."""
    if os.name == 'nt' or sys.platform == 'cygwin':
        #win32pdhutil.ShowAllProcesses()  #uncomment for testing
        pids = win32pdhutil.FindPerformanceAttributesByName(name)

    else:
        get_pids_cmd = ['ps', 'ax']
        h = killableprocess.runCommand(get_pids_cmd, stdout=subprocess.PIPE, universal_newlines=True)
        h.wait()
        data = h.stdout.readlines()
        pids = [int(line.split()[0]) for line in data if line.find(name) is not -1]

    matching_pids = [m for m in pids if m > minimun_pid]
    return matching_pids
def get_pids(name, minimun_pid=0):
    """Get all the pids matching name, exclude any pids below minimum_pid."""
    if os.name == 'nt' or sys.platform == 'cygwin':
        #win32pdhutil.ShowAllProcesses()  #uncomment for testing
        pids = win32pdhutil.FindPerformanceAttributesByName(name)

    else:
        get_pids_cmd = ['ps', 'ax']
        h = killableprocess.runCommand(get_pids_cmd,
                                       stdout=subprocess.PIPE,
                                       universal_newlines=True)
        h.wait()
        data = h.stdout.readlines()
        pids = [
            int(line.split()[0]) for line in data if line.find(name) is not -1
        ]

    matching_pids = [m for m in pids if m > minimun_pid]
    return matching_pids
Exemple #4
0
 def start(self):
     """Start Safari"""
     if sys.platform == 'darwin':
         self.set_proxy_mac()
     elif sys.platform in ('cygwin', 'win32'):
         self.set_proxy_windows()
     # Workaround for bug in nose
     if hasattr(sys.stdout, 'fileno'):
         kwargs = {
             'stdout': sys.stdout,
             'stderr': sys.stderr,
             'stdin': sys.stdin
         }
     else:
         kwargs = {
             'stdout': sys.__stdout__,
             'stderr': sys.__stderr__,
             'stdin': sys.stdin
         }
     self.p_handle = killableprocess.runCommand(
         [self.safari_binary, self.redirection_page], **kwargs)
     logger.info([self.safari_binary, self.redirection_page])