This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: silent option not silencing cURL error
- From: Brian Inglis <Brian dot Inglis at SystematicSw dot ab dot ca>
- To: cygwin at cygwin dot com
- Date: Wed, 30 Nov 2016 22:46:12 -0700
- Subject: Re: silent option not silencing cURL error
- Authentication-results: sourceware.org; auth=none
- References: <CAAXzdLWeMosC0aowDsefXZ2RZ0kowhC46csw7xpmMbcfeRASTg@mail.gmail.com>
- Reply-to: Brian dot Inglis at SystematicSw dot ab dot ca
On 2016-11-30 20:00, Steven Penny wrote:
> $ curl --version
> curl 7.51.0
> Piping cURL to head gives me an error, as expected:
> $ curl https://github.com/github | head
> [...]
> (23) Failed writing body
> However adding the silent option, is not silencing it:
> $ curl --silent https://github.com/github | head
> [...]
> (23) Failed writing body
> I can quiet the error with:
> curl https://github.com/github 2>/dev/null | head
> but silent should be taking care of this. Note the Windows version
> here works as expected:
> http://bintray.com/vszakats/generic/curl
> cross post:
> http://stackoverflow.com/q/40901579/silent-option-not-silencing-curl-error
This is a common problem: not handling a closed pipe silently.
Testing curl on WSL/UfW and Debian does not give this error.
This may be a regression in the newer Cygwin curl version 7.51 vs older
UfW 7.35 and Debian 7.38, or it could be a design decision.
See if has been reported upstream at curl.haxx.se, and report it if not.
Using | sed '10q' also gives the error.
You can work around it using | awk 'NR<=10', | awk -vn=10 'NR<=n', or
| awk 'NR<=n' n=10 to get a similar result.
--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
--
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