If I recall correctly, our _execute_command function started out as a copy of some code from zc.buildout, with as comment that it was a "commands.getoutput() replacement that also works on windows".
Meanwhile, the entire commands module was removed in Py 3 and you should use subprocess now.
The recommended approach to invoking subprocesses is to use the run() function for all use cases it can handle. For more advanced use cases, the underlying Popen interface can be used directly.
The run() function was added in Python 3.5
It looks like our use cases can be handled just fine by run, so I did that.
And I got rid of some more encoding-related and Windows-specific code, with the idea that standard Python probably knows better how to handle this than we do.
The amount of code changed in this PR is not so much, but it covers some complicated code that I don't usually touch. It may help to look at the smaller individual commits that simplify the code step by step.
If I recall correctly, our
_execute_command
function started out as a copy of some code fromzc.buildout
, with as comment that it was a "commands.getoutput() replacement that also works on windows". Meanwhile, the entirecommands
module was removed in Py 3 and you should usesubprocess
now.We already did this, but we were using
subprocess.Popen
. Thesubprocess
documentation says:It looks like our use cases can be handled just fine by
run
, so I did that. And I got rid of some more encoding-related and Windows-specific code, with the idea that standard Python probably knows better how to handle this than we do.The amount of code changed in this PR is not so much, but it covers some complicated code that I don't usually touch. It may help to look at the smaller individual commits that simplify the code step by step.