# Writing to err vs std

4 messages from 2023-03-08 to 2023-03-09. Participants: Jay Asbury, Junio C Hamano.
Thread: https://gitlist.dev/t/59364

## Jay Asbury, 2023-03-08 23:53

Subject: Writing to err vs std
Message-ID: <CAH74SFS3hFzYzJ6eb2YenJh4-Pf_VBzVTo8axnEtHDyaJUB-jw@mail.gmail.com>
URL: https://gitlist.dev/e/CAH74SFS3hFzYzJ6eb2YenJh4-Pf_VBzVTo8axnEtHDyaJUB-jw%40mail.gmail.com

```
I see things like git fetch and other processing writing details to
stderr and not std.  Can someone point to why this is and what the
rule is for determining when to write to err vs std?  See
165f390250874b32ed8158150fe49d574297c9f9 for example.  Is there a
standard in the git project that says write this to err while write
that to std?  Any guidance and why would be appreciated.

Thanks,
Jay Asbury

```

## Junio C Hamano, 2023-03-09 00:02

Subject: Re: Writing to err vs std
Message-ID: <xmqq7cvqrdu6.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqq7cvqrdu6.fsf%40gitster.g
In-Reply-To: <CAH74SFS3hFzYzJ6eb2YenJh4-Pf_VBzVTo8axnEtHDyaJUB-jw@mail.gmail.com>

```
Jay Asbury <vbjay.net@gmail.com> writes:

> I see things like git fetch and other processing writing details to
> stderr and not std.

I assume you meant "not to standard output".  

As a rule of thumb, the core of the output, the information the
end-user asked for, is sent to the standard output, whether it is
machine parseable or otherwise.  And other stuff like progress
meter, warning and advice messages, are sent to the standard error.

This should be documented already in Documentation/CodingGuidelines
for our developers.  Do you think it needs to be documented for
end-users?  I suspect that rather than such "principle", they are
more interested in seeing what message can be squelched with --quiet
and what can be piped to downstream with "git foo |" on case-by-case
basis individually.




```

## Jay Asbury, 2023-03-09 00:15

Subject: Re: Writing to err vs std
Message-ID: <CAH74SFQ9A-hcRfrDs_vE-QhhYTB6V=dbBQQM_0Qdbx88XREwpw@mail.gmail.com>
URL: https://gitlist.dev/e/CAH74SFQ9A-hcRfrDs_vE-QhhYTB6V%3DdbBQQM_0Qdbx88XREwpw%40mail.gmail.com
In-Reply-To: <xmqq7cvqrdu6.fsf@gitster.g>

```
Thanks for the clarification. Some context.
https://github.com/gitextensions/gitextensions/issues/9643 which is a
side effect of https://github.com/gitextensions/gitextensions/pull/9562

So I just wanted to get some clarification on when err vs std should
be used to eliminate confusion.

On Wed, Mar 8, 2023 at 7:02 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Jay Asbury <vbjay.net@gmail.com> writes:
>
> > I see things like git fetch and other processing writing details to
> > stderr and not std.
>
> I assume you meant "not to standard output".
>
> As a rule of thumb, the core of the output, the information the
> end-user asked for, is sent to the standard output, whether it is
> machine parseable or otherwise.  And other stuff like progress
> meter, warning and advice messages, are sent to the standard error.
>
> This should be documented already in Documentation/CodingGuidelines
> for our developers.  Do you think it needs to be documented for
> end-users?  I suspect that rather than such "principle", they are
> more interested in seeing what message can be squelched with --quiet
> and what can be piped to downstream with "git foo |" on case-by-case
> basis individually.
>
>
>


-- 
Jay Asbury
PC Repair and custom programs $30/hr 1hr min
My Biking Blog

```

## Junio C Hamano, 2023-03-09 00:50

Subject: Re: Writing to err vs std
Message-ID: <xmqqttyupx3b.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqttyupx3b.fsf%40gitster.g
In-Reply-To: <CAH74SFQ9A-hcRfrDs_vE-QhhYTB6V=dbBQQM_0Qdbx88XREwpw@mail.gmail.com>

```
Jay Asbury <vbjay.net@gmail.com> writes:

> Thanks for the clarification. Some context.
> https://github.com/gitextensions/gitextensions/issues/9643 which is a
> side effect of https://github.com/gitextensions/gitextensions/pull/9562
>
> So I just wanted to get some clarification on when err vs std should
> be used to eliminate confusion.

I thought that the practice to equate an error with any byte shown
to the standard error died long ago with Tcl ;-)

Thanks.

```
