io.popen call to curl pollutes the buffer when it fails #3
Replies: 4 comments
-
Thank you for the thorough investigation! With uriencoding being added with 6368d1b (or similar) I think it'd be interesting to see another scenario that results in buffer pollution to understand if it's worth fixing. Perhaps another alternative would be to try out plenary's curl wrapper https://github.com/nvim-lua/plenary.nvim/blob/master/lua/plenary/curl.lua. |
Beta Was this translation helpful? Give feedback.
-
oh that might be a good solution, also I noticed that wrapper includes a urlencode function as a bonus! Also, as far as neovim dependencies go, plenary is fairly ubiquitous already. |
Beta Was this translation helpful? Give feedback.
-
epwalsh/obsidian.nvim already depends on plenary in particular |
Beta Was this translation helpful? Give feedback.
-
Yes I really like the idea and plenary feels like such an ubiquitous dependency. The current approach to curl doesn't allow extraction of HTTP response code for instance, which would be very handy. With the new |
Beta Was this translation helpful? Give feedback.
-
Hi thanks for the plugin! I'm trying this out on macos, and encountered
when switching buffers from my obsidian vault. The problem was related to spaces in my filenames, which is what #1 is about.
This issue is about not handling the subprocess stdio streams.
Using lua's native
io.popen
for thecurl
call sends stderr to the cursor position I believe, as described in this open neovim issueFixing the issue might be a simple as appending
>/dev/null 2>&1
to thepopen
call instead of>/dev/null
, but perhaps it would be good to look at plenary.nvim's Job for async subprocess handling (seems simple), oruv.spawn()
(more complex).I actually did give this a shot today using both of those methods though, and neither actually worked properly - I'm not sure what I was missing, but I could share that code in another PR if you're interested.
Beta Was this translation helpful? Give feedback.
All reactions