This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: Possible output redirect bug
- From: "Michel LaBarre" <michel dot labarre at rogers dot com>
- To: "'Alexander Pelevin'" <pvshura at mail dot ru>, <cygwin at cygwin dot com>
- Date: Wed, 28 Feb 2018 22:02:12 -0500
- Subject: RE: Possible output redirect bug
- Authentication-results: sourceware.org; auth=none
- References: <002901d3b0fd$a30dee50$e929caf0$@mail.ru>
> 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