This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: Possible output redirect bug
- From: "Alexander Pelevin via cygwin" <cygwin at cygwin dot com>
- To: "'Michel LaBarre'" <michel dot labarre at rogers dot com>, <cygwin at cygwin dot com>
- Date: Wed, 28 Feb 2018 19:10:27 -0800
- Subject: RE: Possible output redirect bug
- Authentication-results: sourceware.org; auth=none
- Authentication-results: smtp29.i.mail.ru; auth=pass smtp.auth=pvshura at mail dot ru smtp.mailfrom=pvshura at mail dot ru
- References: <002901d3b0fd$a30dee50$e929caf0$@mail.ru> <000601d3b109$b33e8f80$19bbae80$@rogers.com>
- Reply-to: "Alexander Pelevin" <pvshura at mail dot ru>
You are right, thank you for the explanation.
Alex.
-----Original Message-----
From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com] On Behalf Of
Michel LaBarre
Sent: Wednesday, February 28, 2018 7:02 PM
To: 'Alexander Pelevin'; cygwin@cygwin.com
Subject: RE: Possible output redirect bug
> Subject: Possible output redirect bug
>
> Error output is not suppressed:
>
>
> $ cygstart cmd /c "( >&2 pause ) >> test.txt"
>
> $ cat /dev/null >> test.txt >/dev/null 2>&1
> bash: test.txt: Device or resource busy
The error message is not from the process running "cat" which is to what the
redirections apply.
The message is coming from the shell trying to setup file descriptors to
pass to the process running "cat" - you can see "bash:"
The shell cannot open the file for appending.
A simpler demonstration is:
$ cat < zorch > /dev/null 2>&1
bash: zorch: No such file or directory
Alternately:
$ ls zorch
ls: cannot access 'zorch': No such file or directory
shows std err is from "ls" and:
$ ls zorch 2> /dev/null
$
demonstrates redirection working.
Try instead:
( cat /dev/null >> test.txt ) >/dev/null 2>&1
Cheers,
Michel
--
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
--
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