Redirection to stderr

cygwin-mailinglist cygwin-mailinglist@schneiderp.de
Mon Jul 10 12:02:00 GMT 2017


On Mon, July 10, 2017 12:33, Marco Atzeri wrote:
>
> On 10/07/2017 11:06, cygwin-mailinglist wrote:
[...]
>> Rationale aside, it is a bug, isn't it?
>
> I guess a side effect of a lost race.

Which race, exactly?

> Redirecting something on itself it is not guarantee to work.

I'm not sure it is on itself. Are these not two different streams?

When "some-cmd 2> /dev/stderr" is interpreted by the shell I would expect
that /dev/stderr points to a pipe or terminal *of that shell*. The fd 2 in
"2>", on the other hand, should be the standard error stream *of
some-cmd*. The redirection plugs the two together. Similar reasoning
applies to the outer layers of the redirection onion. Each process has a
/dev/stderr which stays (or, rather, should stay) valid until that process
ends. If there is a redirection, the inner process (e.g. some-cmd) must
not "free" or "delete" the pipe or whatever it is now attached to upon
exit; that stream belongs to the caller, e.g. the shell.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list