Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cURL error 23 when writing output to the terminal on Windows #12131

Closed
lordmulder opened this issue Oct 15, 2023 · 1 comment
Closed

cURL error 23 when writing output to the terminal on Windows #12131

lordmulder opened this issue Oct 15, 2023 · 1 comment
Labels
cmdline tool Windows Windows-specific

Comments

@lordmulder
Copy link
Contributor

lordmulder commented Oct 15, 2023

I did this

On some Windows version (tested with WinXP SP-2), cURL fails with the following error, if writing output to the terminal:

curl: (23) Failure writing output to destination

(output to a file still works)

I have been able to track this error down to the tool_write_cb() function 😤

Specifically, the invocation of WriteConsoleW() fails, with Win32 error code ERROR_INVALID_ACCESS.

Setting parameter lpNumberOfCharsWritten to a valid pointer fixed the problem for me.

Please see: #12130

This seems to be a regression from: af3f4e4

I expected the following

cURL should be able to write to the terminal.

curl/libcurl version

cURL 8.4.0

operating system

Windows

@lordmulder
Copy link
Contributor Author

lordmulder commented Oct 15, 2023

closed this as completed in b1b7552

👍

zuoxiaofeng pushed a commit to zuoxiaofeng/curl that referenced this issue Nov 28, 2023
- Pass missing parameter for 'lpNumberOfCharsWritten' to WriteConsoleW()
  function.

Apparently this parameter was *not* optional on older Windows versions.

Issue observed on Windows XP SP2. Issue not observed on Windows 7 SP1.
So at some point between those two Microsoft changed the behavior.

Prior to this change, on those versions if parameter is NULL then the
function call fails with error ERROR_INVALID_ACCESS.

Regression since af3f4e4.

Ref: MicrosoftDocs/Console-Docs#299

Fixes curl#12131
Closes curl#12130
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmdline tool Windows Windows-specific
Development

No branches or pull requests

2 participants