git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Jonathan NiederNext: Jonathan Nieder
Message 8 of 13 in “[PATCHv15 0/5] Expose submodule parallelism to the user”
  1. Stefan BellerFeb 24, 2016
  2. 1/5 run-command: expose default_{start_failure, task_finished}Stefan Beller, Feb 24, 2016
  3. 2/5 run_processes_parallel: add LF when caller is sloppyStefan Beller, Feb 24, 2016
  4. Junio C HamanoFeb 24, 2016
  5. Stefan BellerFeb 24, 2016
  6. Junio C HamanoFeb 24, 2016
  7. Jonathan NiederFeb 24, 2016
  8. Stefan BellerFeb 24, 2016
  9. Jonathan NiederFeb 25, 2016
  10. Junio C HamanoFeb 25, 2016
  11. 3/5 git submodule update: have a dedicated helper for cloningStefan Beller, Feb 24, 2016
  12. 4/5 submodule update: expose parallelism to the userStefan Beller, Feb 24, 2016
  13. 5/5 clone: allow an explicit argument for parallel submodule clonesStefan Beller, Feb 24, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.