Re: [PATCHv15 2/5] run_processes_parallel: add LF when caller is sloppy
- From
Stefan Beller <sbeller@google.com>
- Date
- Feb 24, 2016, 21:59 UTC
- Message-ID
- <CAGZ79kZvD4zFA61XvSLa8fe1PzH91+4ii5vSeH-P+ER2wbQy2g@mail.gmail.com>
- In-Reply-To
- <20160224211947.GO28749@google.com>
On Wed, Feb 24, 2016 at 1:19 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 7 quoted lines
> Stefan Beller wrote: > >> When the callers of parallel processing machine are sloppy with their >> messages, make sure the output is terminated with LF after one child >> process is handled. > > Why not always add \n here?
So you propose to always add a \n if the output length was > 0 ?
> > That would make callers simpler and would make it easier for callers to > know what to do. It also makes it possible to end with \n\n if the > caller wants.
If the caller wants a \n\n it can do so as well using this patch?
If we add an \n unconditionally we run the risk of having lots of empty lines in there. Consider the tests which are already there:
test-run-command run-command-parallel 3 sh -c "printf \"%s\n%s\n\" Hello World" >actual
would produce
cat >expect <<-EOF preloaded output of a child Hello World
preloaded output of a child Hello World
preloaded output of a child Hello World
preloaded output of a child Hello World EOF
as both the child as well as we added a \n, so one empty line was born. And as most child processes actually terminate with a reasonable \n after their output, I would not want to add another \n because it is simpler or easier to predict.
Thanks, Stefan
> > Thanks, > Jonathan