2014-01-29 Andrew Svetlov <[email protected]>:
> When I proposed to add subprocess_shell/subprocess_exec I was keeping in
> mind http://bugs.python.org/issue7839

(Yep, I also mentionned in my email ;-))

> About None/PIPE as default for stdin, stdout and stderr.
> None links to parent's standard streams, right?

Yes.

> Perhaps it's good for simple console script which executes some commands
> like sh/bash does. I assumed that behavior is not perfect for reactive
> systems with running event loop.

I don't understand "not perfect for reactive systems with running
event loop", could you please elaborate?

> Say, if you don't need stderr so maybe DEVNULL is better?

Yes. If you use DEVNULL, the parent doesn't need to care of stderr
(it's directly redirected to /dev/null or NUL on Windows).

> I'm ok with .returncode.
> .poll() is not required, yield from proc.wait() should be enough.
> The same for .communicate(), I this this method was invented to hide
> complexness of working with *blocking* stdstreams and contains
> micro-event-loop inside.

I just added communicate() in my subprocess_stream branch. I also
added a new returncode attribute because communicate() already waits
until the process exit, so calling wait() after that would be
overkill: just get the returncode attribute.

> call()/check_call()/check_output() -- don't know.

Popen has also a context manager which ensure that pipe are closed and
the child exit status is read, even on error. We need maybe something
like that.

Victor

Reply via email to