Ejemplo n.º 1
0
    def _make_subprocess_transport(self,
                                   protocol,
                                   args,
                                   shell,
                                   stdin,
                                   stdout,
                                   stderr,
                                   bufsize,
                                   extra=None,
                                   **kwargs):
        with events.get_child_watcher() as watcher:
            transp = _UnixSubprocessTransport(self,
                                              protocol,
                                              args,
                                              shell,
                                              stdin,
                                              stdout,
                                              stderr,
                                              bufsize,
                                              extra=extra,
                                              **kwargs)
            yield from transp._post_init()
            watcher.add_child_handler(transp.get_pid(),
                                      self._child_watcher_callback, transp)

        return transp
    def _make_subprocess_transport(self, protocol, args, shell,
                                   stdin, stdout, stderr, bufsize,
                                   extra=None, **kwargs):
        with events.get_child_watcher() as watcher:
            transp = _UnixSubprocessTransport(self, protocol, args, shell,
                                              stdin, stdout, stderr, bufsize,
                                              extra=extra, **kwargs)
            yield from transp._post_init()
            watcher.add_child_handler(transp.get_pid(),
                                      self._child_watcher_callback, transp)

        return transp
Ejemplo n.º 3
0
    async def _make_subprocess_transport(self,
                                         protocol,
                                         args,
                                         shell,
                                         stdin,
                                         stdout,
                                         stderr,
                                         bufsize,
                                         extra=None,
                                         **kwargs):
        """Create subprocess transport."""
        with events.get_child_watcher() as watcher:
            waiter = asyncio.Future(loop=self)
            transport = transports.SubprocessTransport(self,
                                                       protocol,
                                                       args,
                                                       shell,
                                                       stdin,
                                                       stdout,
                                                       stderr,
                                                       bufsize,
                                                       waiter=waiter,
                                                       extra=extra,
                                                       **kwargs)

            watcher.add_child_handler(transport.get_pid(),
                                      self._child_watcher_callback, transport)
            try:
                await waiter
            except Exception as exc:
                err = exc
            else:
                err = None
            if err is not None:
                transport.close()
                await transport._wait()
                raise err

        return transport
Ejemplo n.º 4
0
    def _make_subprocess_transport(self, protocol, args, shell,
                                   stdin, stdout, stderr, bufsize,
                                   extra=None, **kwargs):
        """Create subprocess transport."""
        with events.get_child_watcher() as watcher:
            waiter = asyncio.Future(loop=self)
            transport = transports.SubprocessTransport(self, protocol, args, shell,
                                                       stdin, stdout, stderr, bufsize,
                                                       waiter=waiter, extra=extra, **kwargs)

            watcher.add_child_handler(transport.get_pid(), self._child_watcher_callback, transport)
            try:
                yield from waiter
            except Exception as exc:
                err = exc
            else:
                err = None
            if err is not None:
                transport.close()
                yield from transport._wait()
                raise err

        return transport