On 30 August 2014 12:07, Antoine Pitrou <solipsis@pitrou.net> wrote:
On Fri, 29 Aug 2014 18:39:35 +1000 Nick Coghlan <ncoghlan@gmail.com> wrote:
This actually gets a little messy once you start digging into it, as you actually have up to 3 streams to deal with (stdin, stdout, stderr), and may want to set the error handler in addition to the encoding.
At this point, I'd suggest creating a clean, separate TextPopen class (or subclass) without any legacy argument baggage.
As for per-stream settings, we could allow passing each of *encoding* and *errors* in two forms: - as a string, in which case it applies to all three pipes - as a dict, in which case it is looked up for each of the "stdin", "stdout", "stderr" pipes (if configured as pipes)
We could then deprecate the bogus-named "universal_newlines" in the main Popen class.
Sounds reasonable. I'll look into that (no promises on timescales :-)) In practice, I doubt we'd need per-stram encodings particularly often, so I like the idea of *not* clutteringthe API to cope with them. I'm curious, by the way - what arguments do you consider as "legacy baggage" (a lot of them seem to me to be OS-specific and/or specialised rather than legacy). In practice, we'd probably need to do something about the utility functions like check_output and communicate as well. Paul