Executes a subprocess in the background.
439771
def exec_background(controller, cmd, *args):
    """"""
    controller.logger.info("Executing in the background: {0} {1}",
                           cmd, " ".join(args))

    try:
        subprocess.Popen([cmd] + list(args),
                         stdout=open(os.devnull, "wb"),
                         stderr=open(os.devnull, "wb"))
    except OSError as err:
        controller.logger.error("Failed to execute process: {0}", err)
361277
def run(self, background=False):
        """"""
        if self.__bgthread:
            raise Exception('run has already been called (since last stop)')
        self.__shutdown.clear()
        if background:
            self.__bgthread = Thread(target=self.__run, name=('bg_' + self.__client.agent_id))
            self.__bgthread.daemon = True
            self.__bgthread.start()
        else:
            self.__run()
995595
def execute_command(command=None):
    """"""
    process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    stdout, stdin = process.communicate()
    process.wait()
    return (stdout, stdin), process.returncode
662830
def run_updater_in_background(self):
        
        thread = threading.Thread(target=self.updater_loop())
        thread.daemon = True
        thread.start()
55193
def run(self):
        """"""
        ret = eventlet.spawn(self.context(self.func))
        eventlet.sleep(self.seconds)
        try:
            ret.wait()
        except Exception:  # pylint: disable=broad-except
            traceback.print_exc()
        self.thread = eventlet.spawn(self.run)
1300501
def run(self, block=True, binary=False, cwd=None):
        """"""
        self.blocking = block

        # Use subprocess.
        if self.blocking:
            popen_kwargs = self._default_popen_kwargs.copy()
            popen_kwargs['universal_newlines'] = not binary
            if cwd:
                popen_kwargs['cwd'] = cwd
            s = subprocess.Popen(self._popen_args, **popen_kwargs)
        # Otherwise, use pexpect.
        else:
            pexpect_kwargs = self._default_pexpect_kwargs.copy()
            if binary:
                pexpect_kwargs['encoding'] = None
            if cwd:
                pexpect_kwargs['cwd'] = cwd
            # Enable Python subprocesses to work with expect functionality.
            pexpect_kwargs['env']['PYTHONUNBUFFERED'] = '1'
            s = PopenSpawn(self._popen_args, **pexpect_kwargs)
        self.subprocess = s
        self.was_run = True
814951
protected function runCommandInBackground()
    {
        $this->callBeforeCallbacks();

        (new Process(
            $this->buildCommand(), base_path(), null, null, null
        ))->run();
    }
690242
public ProcessInfo execute(boolean background,String...  command)
	{
		 ProcessBuilder pb = new ProcessBuilder(command);

		 
		return executeProcess(background,pb);
		
	}
412004
def multithreader(args, paths):
    """"""

    def shellprocess(path):
        """Return a ready-to-use subprocess."""
        import subprocess
        return subprocess.Popen(args + [path],
                                stderr=subprocess.DEVNULL,
                                stdout=subprocess.DEVNULL)

    processes = [shellprocess(path) for path in paths]

    for process in processes:
        process.wait()
715544
def run(self):
        '''
        
        '''
        self.thread = Thread(target=self.__processQueue)
        self.thread.start()
562520
def execute_locally(self):
        """"""
        # Make script file #
        self.make_script()
        # Do it #
        with open(self.kwargs['out_file'], 'w') as handle:
            sh.python(self.script_path, _out=handle, _err=handle)
1098447
def subprocess(cls, cmd, **kwargs):
    
    def call(args):
      return subprocess.call(cmd + args, **kwargs)
    return cls(call)
915662
def run(self, bin, *args, **kwargs):
        
        bin = self._bin(bin)

        cmd = [bin] + list(args)
        shell = kwargs.get("shell", False)
        call = kwargs.pop("call", False)
        input_ = kwargs.pop("input_", None)

        if shell:
            cmd = list_to_shell_command(cmd)

        try:
            if self._is_windows:
                kwargs["shell"] = True

            if input_:
                p = subprocess.Popen(
                    cmd,
                    stdin=subprocess.PIPE,
                    stdout=subprocess.PIPE,
                    stderr=subprocess.STDOUT,
                    **kwargs
                )
                output = p.communicate(encode(input_))[0]
            elif call:
                return subprocess.call(cmd, stderr=subprocess.STDOUT, **kwargs)
            else:
                output = subprocess.check_output(
                    cmd, stderr=subprocess.STDOUT, **kwargs
                )
        except CalledProcessError as e:
            raise EnvCommandError(e)

        return decode(output)
131496
def _execute(cmd):
        """"""
        cmd_parts = shlex.split(cmd)
        if sys.version_info[0] < 3:

            cmd_parts = shlex.split(cmd.encode('ascii'))

        proc = subprocess.Popen(
            cmd_parts,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
        )
        out, err = proc.communicate()
        if proc.returncode != 0:

            raise subprocess.CalledProcessError(
                returncode=proc.returncode,
                cmd=cmd,
                output=err,
            )

        return CommandResult(
            code=proc.returncode,
            out=out.decode('utf8'),
            err=err.decode('utf8'),
        )
413094
async def main():
    """"""
    for c in (1, 2, 4,):
        async with Sublemon(max_concurrency=c) as s:
            start = time.perf_counter()
            await asyncio.gather(one(s), two(s))
            end = time.perf_counter()
            print('Limiting to', c, 'concurrent subprocess(es) took',
                  end-start, 'seconds\n')
834131
def run(self):
        """"""
        if win_based:
            raise NotImplementedError("Please run main_loop, "
                                      "backgrounding not supported on Windows")
        self.background_process = mp.Process(target=self.main_loop)
        self.background_process.start()
446508
def run_ext(args):
    """"""
    try:
        subprocess.check_call(args)
    except subprocess.CalledProcessError as exc:
        print(exc)
        print(exc.cmd)
        print(exc.returncode)
        print(exc.output)
        raise