Create a process in which the isolated code will be run.
339018
def start(self):
        ''''''
        assert self._client is None

        logger.debug('IsolationContext[%d] starting', id(self))

        # Create the queues
        request_queue = multiprocessing.Queue()
        response_queue = multiprocessing.Queue()

        # Launch the server process
        server = Server(request_queue, response_queue)  # Do not keep a reference to this object!
        server_process = multiprocessing.Process(target=server.loop)
        server_process.start()

        # Create a client to talk to the server
        self._client = Client(server_process, request_queue, response_queue)
808395
def execute_code(self, lines, current_client=True, clear_variables=False):
        """"""
        sw = self.get_current_shellwidget()
        if sw is not None:
            if sw._reading:
                pass
            else:
                if not current_client:
                    # Clear console and reset namespace for
                    # dedicated clients
                    # See issue 5748
                    try:
                        sw.sig_prompt_ready.disconnect()
                    except TypeError:
                        pass
                    sw.reset_namespace(warning=False)
                elif current_client and clear_variables:
                    sw.reset_namespace(warning=False)
                # Needed to handle an error when kernel_client is none
                # See issue 6308
                try:
                    sw.execute(to_text_string(lines))
                except AttributeError:
                    pass
            self.activateWindow()
            self.get_current_client().get_control().setFocus()
699680
def execute(self, args):
        """"""
        _run_atstart()
        hook_name = os.path.basename(args[0])
        if hook_name in self._hooks:
            try:
                self._hooks[hook_name]()
            except SystemExit as x:
                if x.code is None or x.code == 0:
                    _run_atexit()
                raise
            _run_atexit()
        else:
            raise UnregisteredHookError(hook_name)
348087
def run(cmd, input=None, capture_output=False, check=False, quiet=False, **kwargs):
    """"""
    if input is not None:
        kwargs['stdin'] = subprocess.PIPE
    if capture_output:
        kwargs['stdout'] = kwargs['stderr'] = subprocess.PIPE

    try:
        proc = subprocess.Popen(cmd, startupinfo=get_startupinfo(), **kwargs)
    except OSError as e:
        if e.errno == errno.ENOENT:
            raise ExecutableNotFound(cmd)
        else:
            raise

    out, err = proc.communicate(input)

    if not quiet and err:
        stderr_write_bytes(err, flush=True)
    if check and proc.returncode:
        raise CalledProcessError(proc.returncode, cmd, output=out, stderr=err)

    return out, err
671787
def run(self):
        """"""
        environment = os.environ.copy()
        # necessary for reading from processes that don't flush
        # stdout automatically
        environment["PYTHONUNBUFFERED"] = "1"
        self.proc = Popen(self.command, env=environment, stdout=PIPE, stderr=PIPE)
        Process.instances.append(self)
655384
def run(self, *args):
        """"""

        self.parser.parse_args(args)

        code = self.affiliate()

        return code
271515
function start() {
    proc = spawn(procCommand, procArgs, procOptions);

    var onClose = function (code) {
      if (!restarting) {
        process.exit(code);
      }
      start();
      restarting = false;
    };

    proc.on('error', function () {
      debug('restarting due error');
      restarting = true;
      proc.kill('SIGINT');
    });

    proc.on('close', onClose);
  }
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)
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
1111255
protected function createSwooleProcess()
    {
        $process = new SwooleProcess(function ($process) {
            $this->running = true;

            $process->name(sprintf('%s : Process %s', $this->app->name(), $this->getName() ?: $process->pid));

            $this->dispatchEvent('Start', $this->server, $this);

            swoole_event_add($this->swooleProcess->pipe, function () {
                if (false !== ($data = $this->swooleProcess->read())) {
                    $this->dispatchEvent('Message', $this->server, $this, $data);
                }
            });

            call_user_func($this->runnableRetriever(), $this->server, $this);
        }, false, true);

        $process->setBlocking($this->isBlocking());

        return $process;
    }
294107
def exec_(controller, cmd, *args):
    """"""
    controller.logger.info("Executing: {0} {1}", cmd, " ".join(args))

    try:
        subprocess.check_call([cmd] + list(args))
    except (OSError, subprocess.CalledProcessError) as err:
        controller.logger.error("Failed to execute process: {0}", err)
841198
@Override
    protected Execute prepareExec() {
        Execute original = super.prepareExec();
        Execute exec = new Execute(this, createWatchdog()) {
            @Override
            protected void waitFor(Process process) {
                try {
                    expectSupport.execute();
                    if (destroyProcess) {
                        process.destroy();
                    }
                } catch (Exception e) {
                    process.destroy();
                    throw new BuildException(e);
                } finally {
                    super.waitFor(process);
                }
            }
        };
        exec.setNewenvironment(newEnvironment);
        exec.setAntRun(getProject());
        exec.setWorkingDirectory(original.getWorkingDirectory());
        exec.setEnvironment(original.getEnvironment());
        return exec;
    }
730962
def init_process(self) -> None:
        
        default_loop = asyncio.get_event_loop()
        if default_loop.is_running():
            default_loop.close()
            self.loop = asyncio.new_event_loop()
            asyncio.set_event_loop(self.loop)
        else:
            self.loop = default_loop
        super().init_process()
1299858
def create_process_worker(self, cmd_list, environ=None):
        """"""
        worker = ProcessWorker(cmd_list, environ=environ)
        self._create_worker(worker)
        return worker
910285
def spawn(spec, kwargs, pass_fds=()):
    
    r, w = os.pipe()
    for fd in [r] + list(pass_fds):
        set_inheritable(fd, True)

    preparation_data = get_preparation_data()

    r_handle = get_handle(r)
    args, env = get_command_line(pipe_handle=r_handle)
    process = subprocess.Popen(args, env=env, close_fds=False)

    to_child = os.fdopen(w, 'wb')
    to_child.write(pickle.dumps([preparation_data, spec, kwargs]))
    to_child.close()

    return process
1167683
def _execute(self, code):
        
        self.globals['example'] = self.example
        eval(code, self.globals)
940375
def run_external_subprocess_in_background(command_list, env=None):
    """"""
    if system_os == "Windows":
        DETACHED_PROCESS = 0x00000008
        p = subprocess.Popen(command_list, shell=False, stdin=None, stdout=None,
                stderr=None, close_fds=True, creationflags=DETACHED_PROCESS, env=env)
    else:
        p = subprocess.Popen(command_list, shell=False, stdin=None, stdout=None,
                stderr=None, close_fds=True, env=env)
    return p