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

plenary.curl fails on Windows #176

Closed
mr-majkel opened this issue Jun 29, 2021 · 3 comments · Fixed by #238
Closed

plenary.curl fails on Windows #176

mr-majkel opened this issue Jun 29, 2021 · 3 comments · Fixed by #238

Comments

@mr-majkel
Copy link

mr-majkel commented Jun 29, 2021

I have tried to run some plenary.curl dependent plugin on Windows (with curl) but it fails on the very early stage, I think because of this line where it creates a tmp file in the hardcoded /tmp/ folder that is not acceptable path in Windows. Here is a reproducible example:

local curl = require('plenary.curl')
curl.request{ 
  url = "https://postman-echo.com/get",
  method = "get",
  accept = "application/json"
}

It throws the following error in my nvim (NVIM v0.5.0-dev+1423-ge2d3ad7bc):

E5113: Error while calling lua chunk: ...Data\Local\nvim\plugged\plenary.nvim\lua\plenary\job.lua:495: 'curl -sSL -D /tmp/plenary_curl_b69140fb.headers --compressed -X GET -H Accept: application/json https://postman-echo.com/get' wa
s unable to complete in 10000 ms
Error executing luv callback:
...ata\Local\nvim\plugged\plenary.nvim\lua\plenary\path.lua:571: ENOENT: no such file or directory: /tmp/plenary_curl_b69140fb.headers

It works on wsl.

@jameshiew
Copy link
Contributor

On my Windows the issue was curl was exiting with code 2 and the error message was relating to compression not being supported. Changing compressed = true to compressed = false in the request specs fixed it for me. I've been experimenting with a fork of the curl.lua code and it looks like the job on_exit callback should check whether code is 0 or not before calling parse.response, as if the curl process didn't successfully write that headers file then the ENOENT error can happen.

@Conni2461
Copy link
Collaborator

i thought #178 restored windows support?

do you mind opening a PR, if you found a solution for windows. I dont own a windows machine so i cant test or fix it.

@jameshiew
Copy link
Contributor

@Conni2461 I've opened #238 which improves the error message so it is more obvious what the issue is though Windows users would still need to fix the error themselves by installing a version of curl which supports compression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants