public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Eliot Moss <moss@cs.umass.edu>
To: cygwin@cygwin.com
Subject: Re: Redirection to stderr
Date: Mon, 10 Jul 2017 16:32:00 -0000	[thread overview]
Message-ID: <4020dbe3-bfb1-e0fc-22b2-0ab4e1330975@cs.umass.edu> (raw)
In-Reply-To: <581103da7715b704f454365749ab3b00.squirrel@mail.schneiderp.de>

On 7/10/2017 9:41 AM, Peter Schneider wrote:
> On Mon, July 10, 2017 14:55, Andrey Repin wrote:
>> Greetings, cygwin-mailinglist!
>>
>>> 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?
>>
>> echo aaa > a
>> cat a > a
>
> The problem with "cat a > a" is entirely unrelated to "some-cmd
> 2>/dev/stderr". (Apart from /dev/stderr not being a regular file, some-cmd
> does not receive a path argument which it tries to open, the way "cat a"
> does.)

Understanding what is happening would require figuring out which process
opens /dev/stderr and when.  However, there is another approach that might
get at what you want: /proc/nnnn/fd/2 gives access to file descriptor 2
(standard error) of process number nnnn.  If you can get the right pid,
and you have access rights, then you can open that.  Here the PPID
environment variable may be useful.

Which stderr is it you're hoping the output will go to?

Regards - EM

--
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

  reply	other threads:[~2017-07-10 16:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <baa3a4f84968dd6aa9869d2c9f58197f.squirrel@mail.schneiderp.de>
2017-07-10 10:33 ` Marco Atzeri
2017-07-10 12:02   ` cygwin-mailinglist
2017-07-10 13:05     ` Andrey Repin
2017-07-10 13:41       ` Peter Schneider
2017-07-10 16:32         ` Eliot Moss [this message]
2017-07-10 18:43     ` Hans-Bernhard Bröker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4020dbe3-bfb1-e0fc-22b2-0ab4e1330975@cs.umass.edu \
    --to=moss@cs.umass.edu \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).