-
Notifications
You must be signed in to change notification settings - Fork 21
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
Use utils.system() instead of vim.system() #41
Conversation
It's working for me after these changes: diff --git a/lua/r/utils.lua b/lua/r/utils.lua
index f3267f3..6993046 100644
--- a/lua/r/utils.lua
+++ b/lua/r/utils.lua
@@ -193,8 +193,8 @@ function M.system(cmd, opts)
{
args = vim.list_slice(cmd, 2),
stdio = { nil, stdout, stderr },
- cwd = opts.cwd,
- detach = opts.detach,
+ cwd = (opts and opts.cwd) and opts.cwd or ".",
+ detach = (opts and opts.detach) and opts.detach or false,
hide = true
},
function(code, signal)
@@ -216,7 +216,7 @@ function M.system(cmd, opts)
if err then error(err) end
if data ~= nil then
- if opts.text then
+ if opts and opts.text then
data = data:gsub("\r\n", "\n")
table.insert(store, data)
else
@@ -235,7 +235,7 @@ function M.system(cmd, opts)
end
if stderr then
stderr_data = {}
- stderr:read_start(stdio_handler(state.stderr, stdout_data))
+ stderr:read_start(stdio_handler(state.stderr, stderr_data))
end
local methods = {}
@@ -248,6 +248,7 @@ function M.system(cmd, opts)
local err = string.format("Command timed out: %s", table.concat(cmd, " "))
return { code = 0, signal = 2, stdout = "", stderr = err }
end
+ return state.result
end
return setmetatable({ pid = state.pid, _state = state }, { __index = methods }) |
I'm not sure if using "." as the default value for |
Thanks for the catch! |
I still lack a proper setup for developing Vim/Lua plugins. I need to learn how to test submodules despite relaunching Neovim. |
Will |
It's working on Linux. Can I merge it now? |
I checked it on Windows and macOS. Both work ok. I think we can merge it. |
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
* Use utils.system() instead of vim.system() * Use vim.loop instead of vim.uv
Pull request overview
system()
function to mimickvim.system()
's behavior. This fixesvim.system()
api did not exist in Neovim current release (v0.9.5) #36.