Пример #1
0
def execute(command, host=None, bg=True, **kwds):
    '''execute a command (possibly) on a remote host

Execute a process, and return the launcher. Use 'response' to retrieve the
response from the executed command. Use 'kill' to kill the launcher, and 'pid'
to get the process id for the launcher.

Inputs:
    command -- command string to be executed
    host    -- hostname of execution target  [default = None (i.e. run locally)]
    bg      -- run as background process?  [default = True]
  '''
    #XXX: options, background, stdin can be set w/ kwds (also name, launcher)
    bg = bool(bg)  # overrides 'background'
    if host in [None, '']:
        from Launcher import Launcher
        launcher = Launcher(**kwds)
        launcher(command=command, background=bg)
    else:
        from LauncherSSH import LauncherSSH
        opt = kwds.pop('options', '-q')
        launcher = LauncherSSH(**kwds)
        launcher(options=opt, command=command, host=host, background=bg)
    logging.info('executing {%s}', launcher.message)
    launcher.launch()
    #response = launcher.response()
    #launcher.kill()
    #return response
    return launcher
Пример #2
0
def execute(command, host=None, bg=True, **kwds):
  '''execute a command (possibly) on a remote host

Execute a process, and return the launcher. Use 'response' to retrieve the
response from the executed command. Use 'kill' to kill the launcher, and 'pid'
to get the process id for the launcher.

Inputs:
    command -- command string to be executed
    host    -- hostname of execution target  [default = None (i.e. run locally)]
    bg      -- run as background process?  [default = True]
  '''
  #XXX: options, background, stdin can be set w/ kwds (also name, launcher)
  bg = bool(bg) # overrides 'background'
  if host in [None, '']:
    from Launcher import Launcher
    launcher = Launcher(**kwds)
    launcher(command=command, background=bg)
  else:
    from LauncherSSH import LauncherSSH
    opt = kwds.pop('options', '-q')
    launcher = LauncherSSH(**kwds)
    launcher(options=opt, command=command, host=host, background=bg)
  logging.info('executing {%s}', launcher.message)
  launcher.launch()
 #response = launcher.response()
 #launcher.kill()
 #return response
  return launcher
Пример #3
0
 def setUp(self):
     launcher = Launcher(open_dev_tools=False)
     self.auto_chrome = launcher.launch()