Code review comment for lp:~salgado/linaro-image-tools/improve-cmd_runner

Revision history for this message
James Westby (james-w) wrote :

On Thu, 09 Dec 2010 19:39:52 -0000, Guilherme Salgado <email address hidden> wrote:
> The nice thing is that it works with communicate() just fine as communicate() wait()s:
>
> >>> p = Popen('false', stdout=PIPE, stdin=PIPE, stderr=PIPE)
> >>> p.communicate('')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python2.6/subprocess.py", line 691, in communicate
> return self._communicate(input)
> File "/usr/lib/python2.6/subprocess.py", line 1258, in _communicate
> self.wait()
> File "media_create/cmd_runner.py", line 38, in wait
> raise SubcommandNonZeroReturnValue(self._my_args, returncode)
> media_create.cmd_runner.SubcommandNonZeroReturnValue: Sub process "false" returned a non-zero value: 1

Ah, ok.

Is it still possible to get the output when using communicate() with
pipes?

I'm not sure we do that anyway right now, but there are cases when you
have to use communicate, with stdout/stderr pipes, and you want to
report the output if the command fails.

Thanks,

James

« Back to merge proposal