curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Cmd.exe and «PowerShell ISE» in «MS Windows 10»

From: Ray Satiro via curl-users <curl-users_at_cool.haxx.se>
Date: Thu, 6 Feb 2020 16:29:25 -0500

On 2/6/2020 1:29 PM, Коваленко Анатолий Викторович via curl-users wrote:
> Head by «PowerShell ISE»:
> = = = = = = = = = = Begin = = = = = = = = = =
> & ".\curl-7.68.0-win64-mingw\bin\curl.exe" "-I""https://curl.haxx.se/windows/dl-7.68.0/curl-7.68.0-win64-mingw.zip"
> curl.exe : % Total % Received % Xferd Average Speed Time Time Time Current
> строка:1 знак:1
> + & ".\curl-7.68.0-win64-mingw\bin\curl.exe" "-I" "https://curl.haxx.se ...
> + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + CategoryInfo : NotSpecified: ( % Total % ... Time Current:String) [], RemoteException
> + FullyQualifiedErrorId : NativeCommandError
>
> Dload Upload Total Spent Left Speed
> 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
> 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
> 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
> 0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0
> 0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0
> 0 0 0 0 0 0 0 0 --:--:-- 0:00:04 --:--:-- 0
> 0 0 0 0 0 0 0 0 --:--:-- 0:00:05 --:--:-- 0
> 0 3202k 0 0 0 0 0 0 --:--:-- 0:00:05 --:--:-- 0
> HTTP/2 200
> server: Apache
> x-frame-options: SAMEORIGIN
> last-modified: Wed, 08 Jan 2020 05:33:42 GMT
> etag: "3209a3-59b9a3c455980"
> cache-control: max-age=31536000
> expires: Thu, 07 Jan 2021 12:27:01 GMT
> x-content-type-options: nosniff
> content-security-policy: default-src 'self'www.fastly-insights.com; style-src 'unsafe-inline' 'self'
> strict-transport-security: max-age=31536000; includeSubDomains;
> content-type: application/zip
> via: 1.1 varnish
> accept-ranges: bytes
> date: Thu, 06 Feb 2020 18:02:04 GMT
> via: 1.1 varnish
> age: 2525702
> x-served-by: cache-bma1628-BMA, cache-ams21034-AMS
> x-cache: HIT, HIT
> x-cache-hits: 1, 1
> x-timer: S1581012124.391053,VS0,VE6
> content-length: 3279267
> = = = = = = = = = = End = = = = = = = = = =
> Pink text of error. Is it normally or bug?
> With parameter -O (download file) pink text too (much more).
> What is «FullyQualifiedErrorId : NativeCommandError»? Is it error of Windows or of curl?
> Please, do not talk about parameter --silent and mode SilentlyContinue. Do not hide errors if they
> exists.

That is not a bug in curl.

If the transfer output is to a terminal then curl will disable the
progress meter [1]. Normal powershell offers stdout with terminal
compatibility but powershell's ISE does not (instead it's like writing
to a file) so that is why curl only outputs the progress meter when you
use the ISE. The progress meter is output to stderr. It seems Powershell
puts stderr output in a NativeCommandError object.

You can use --no-progress-meter [2] to hide the progress meter output.
Since you want to see the stderr output I'd guess you can handle the
exception that uses NativeCommandError (I haven't tried this) or you can
combine stdout and stderr in powershell as discussed on stackoverflow
[3], but then the output can get mixed together.  & foo 2>&1 | %{ "$_" }

& curl "-I"
"https://curl.haxx.se/windows/dl-7.68.0/curl-7.68.0-win64-mingw.zip"
2>&1 | %{ "$_" }

[1]: https://curl.haxx.se/docs/manpage.html#PROGRESS
[2]: https://curl.haxx.se/docs/manpage.html#--no-progress-meter
[3]: https://stackoverflow.com/a/20950421

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-02-06