CliRunner
: restrict mix_stderr
influence to <output>
; keep <stderr>
and <stdout>
stable
#2522
Milestone
8000
CliRunner
: restrict mix_stderr
influence to <output>
; keep <stderr>
and <stdout>
stable
#2522
Uh oh!
There was an error while loading. Please reload this page.
Let's start with the current behaviour of
CliRunner
regarding itsmix_stderr
option.Here is a simple CLI:
When called, the CLI above produces:
What I'd like to propose is to instead have
CliRunner
produce this result:So what I propose is to streamline the semantics of
result.stdout
,result.stderr
andresult.output
:result.stdout
always contain the pure output to<stdout>
. Never mangle<stderr>
in it.result.stderr
always contain the pure output to<stderr>
. Never raise an error.result.output
as the content the user is expected to see:<stdout>
ifmix_stderr=False
<stdout>
and<stderr>
ifmix_stderr=True
The advantage of this is we could properly check the individual
<stdout>
and<stderr>
streams, and check for the user output by inspecting<output>
.The raised exception in
<stderr>
has been introduced in7.0
for backward compatibility, because the code prior to7.0
wasn't returning thestderr
/stderr
split output (see #868). It's from 2017 so we can safely change that behaviour by now.Note that I explicitely numbered each
echo()
statement to highlight the print order. If a refactor is attempted, I am anticipating some edge-cases around the preservation of order, so it's good to have simple code to test that.The text was updated successfully, but these errors were encountered: