Re: [PATCH v2 1/6] CodingGuidelines: add shell piping guidelines
On Tue, Sep 18, 2018 at 10:11 PM Matthew DeVore <matvore@google.com> wrote:
> Yes, it's probably better to add a point about that. Here is the new
> documentation after applying your suggestions:
>
> - If a piped sequence which spans multiple lines, put each statement
Show 12 quoted lines
> on a separate line and put pipes on the end of each line, rather
> than the start. This means you don't need to use \ to join lines,
> since | implies a join already.
> [...]
> - In a pipe, any exit codes returned by processes besides the last
> are ignored. This means that if git crashes at the beginning or
> middle of a pipe, it may go undetected. Prefer writing the output
> of that command to a temporary file with '>' rather than pipe it.
>
> - The $(git ...) construct also discards git's exit code, so if the
> goal is to test that particular command, redirect its output to a
> temporary file rather than wrap it with $( ).