nvim-lua/plenary.nvim

Failed to spawn process

eyalk5 opened this issue · 10 comments

eyalk5 commented

I am working with diffview.
I am getting when I do DiffViewFileHistory on certain folder.

Error executing Lua callback: ...ers\ekarni\.vim\plugged\plenary.nvim/lua/plenary/job.lua:405: Failed to spawn process: {
  _additional_on_exit_callbacks = {},
  _raw_cwd = "//192.168.89.144/c$/readlsassmem",
  _shutdown_check = <userdata 1>,
  _stderr_results = {},
  _stdout_results = {},
  _user_on_stderr = <function 1>,
  args = { "rev-parse", "--path-format=absolute", "--git-dir" },
  command = "git",
  enable_handlers = true,
  enable_recording = true,
  interactive = true,
  pid = "ENOENT: no such file or directory",
  stderr = <userdata 2>,
  stdin = <userdata 3>,
  stdout = <userdata 4>,
  user_data = {},
  <metatable> = <1>{
    __index = <table 1>,
    _create_uv_options = <function 2>,
    _execute = <function 3>,
    _pipes_are_closed = <function 4>,
    _prepare_pipes = <function 5>,
    _reset = <function 6>,
    _shutdown = <function 7>,
    _stop = <function 8>,
    add_on_exit_callback = <function 9>,
    after = <function 10>,
    after_failure = <function 11>,
    after_success = <function 12>,
    and_then = <function 13>,
    and_then_on_failure = <function 14>,
    and_then_on_failure_wrap = <function 15>,
    and_then_on_success = <function 16>,
    and_then_on_success_wrap = <function 17>,
    and_then_wrap = <function 18>,
    chain = <function 19>,
    chain_status = <function 20>,
    co_wait = <function 21>,
    is_job = <function 22>,
    join = <function 23>,
    new = <function 24>,
    pid = <function 25>,
    result = <function 26>,
    send = <function 27>,
    shutdown = <function 28>,
    start = <function 29>,
    stderr_result = <function 30>,
    sync = <function 31>,
    wait = <function 32>
  }
}
stack traceback:
	...ers\ekarni\.vim\plugged\plenary.nvim/lua/plenary/job.lua:405: in function '_execute'
	...ers\ekarni\.vim\plugged\plenary.nvim/lua/plenary/job.lua:448: in function 'start'
	...ers\ekarni\.vim\plugged\plenary.nvim/lua/plenary/job.lua:452: in function 'sync'
	...ekarni\.vim\plugged\diffview.nvim/lua/diffview/utils.lua:451: in function 'exec_sync'
	...ged\diffview.nvim/lua/diffview/vcs/adapters/git/init.lua:265: in function 'get_dir'
	...ged\diffview.nvim/lua/diffview/vcs/adapters/git/init.lua:241: in function 'init'
	...s\ekarni\.vim\plugged\diffview.nvim/lua/diffview/oop.lua:58: in function 'GitAdapter'
	...ged\diffview.nvim/lua/diffview/vcs/adapters/git/init.lua:211: in function 'get_adapter'
	...s\ekarni\.vim\plugged\diffview.nvim/lua/diffview/lib.lua:79: in function 'file_history'
	...\ekarni\.vim\plugged\diffview.nvim/lua/diffview/init.lua:122: in function 'file_history'
	...rs\ekarni\.vim\plugged\diffview.nvim\plugin\diffview.lua:34: in function <...rs\ekarni\.vim\plugged\diffview.nvim\plugin\diffview.lua:27>
stack traceback:
	[C]: in function 'error'
	...ers\ekarni\.vim\plugged\plenary.nvim/lua/plenary/job.lua:405: in function '_execute'
	...ers\ekarni\.vim\plugged\plenary.nvim/lua/plenary/job.lua:448: in function 'start'
	...ers\ekarni\.vim\plugged\plenary.nvim/lua/plenary/job.lua:452: in function 'sync'
	...ekarni\.vim\plugged\diffview.nvim/lua/diffview/utils.lua:451: in function 'exec_sync'
	...ged\diffview.nvim/lua/diffview/vcs/adapters/git/init.lua:265: in function 'get_dir'
	...ged\diffview.nvim/lua/diffview/vcs/adapters/git/init.lua:241: in function 'init'
	...s\ekarni\.vim\plugged\diffview.nvim/lua/diffview/oop.lua:58: in function 'GitAdapter'
	...ged\diffview.nvim/lua/diffview/vcs/adapters/git/init.lua:211: in function 'get_adapter'
	...s\ekarni\.vim\plugged\diffview.nvim/lua/diffview/lib.lua:79: in function 'file_history'
	...\ekarni\.vim\plugged\diffview.nvim/lua/diffview/init.lua:122: in function 'file_history'
	...rs\ekarni\.vim\plugged\diffview.nvim\plugin\diffview.lua:34: in function <...rs\ekarni\.vim\plugged\diffview.nvim\plugin\diffview.lua:27>
83 more lines

Z3rio commented

I seem to be running into this issue aswell.
More specifically when I use :Telescope git_files

E5108: Error executing lua: ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:404: Failed to spawn process: {
  _additional_on_exit_callbacks = {},
  _raw_cwd = "C:\\qbcore\\fx-data\\resources\\[zerio]",
  _shutdown_check = <userdata 1>,
  _stderr_results = {},
  _stdout_results = {},
  _user_on_stderr = <function 1>,
  args = { "rev-parse", "--show-toplevel" },
  command = "git",
  enable_handlers = true,
  enable_recording = true,
  interactive = true,
  pid = "ENOENT: no such file or directory",
  stderr = <userdata 2>,
  stdin = <userdata 3>,
  stdout = <userdata 4>,
  user_data = {},
  <metatable> = <1>{
    __index = <table 1>,
    _create_uv_options = <function 2>,
    _execute = <function 3>,
    _pipes_are_closed = <function 4>,
    _prepare_pipes = <function 5>,
    _reset = <function 6>,
    _shutdown = <function 7>,
    _stop = <function 8>,
    add_on_exit_callback = <function 9>,
    after = <function 10>,
    after_failure = <function 11>,
    after_success = <function 12>,
    and_then = <function 13>,
    and_then_on_failure = <function 14>,
    and_then_on_failure_wrap = <function 15>,
    and_then_on_success = <function 16>,
    and_then_on_success_wrap = <function 17>,
    and_then_wrap = <function 18>,
    chain = <function 19>,
    chain_status = <function 20>,
    co_wait = <function 21>,
    is_job = <function 22>,
    join = <function 23>,
    new = <function 24>,
    pid = <function 25>,
    result = <function 26>,
    send = <function 27>,
    shutdown = <function 28>,
    start = <function 29>,
    stderr_result = <function 30>,
    sync = <function 31>,
    wait = <function 32>
  }
}
stack traceback:
	...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:404: in function '_execute'
	...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:447: in function 'start'
	...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:451: in function 'sync'
	...al/nvim-data/lazy/telescope.nvim/lua/telescope/utils.lua:417: in function 'get_os_command_output'
	...data/lazy/telescope.nvim/lua/telescope/builtin/__git.lua:470: in function 'set_opts_cwd'
	...data/lazy/telescope.nvim/lua/telescope/builtin/__git.lua:493: in function 'v'
	...-data/lazy/telescope.nvim/lua/telescope/builtin/init.lua:584: in function <...-data/lazy/telescope.nvim/lua/telescope/builtin/init.lua:543>
	...lazy/telescope.nvim/lua/telescope/builtin/__internal.lua:113: in function 'run_replace_or_original'
	...im-data/lazy/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func'
	...nvim-data/lazy/telescope.nvim/lua/telescope/mappings.lua:257: in function <...nvim-data/lazy/telescope.nvim/lua/telescope/mappings.lua:256>
stack traceback:
	[C]: in function 'error'
	...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:404: in function '_execute'
	...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:447: in function 'start'
	...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:451: in function 'sync'
	...al/nvim-data/lazy/telescope.nvim/lua/telescope/utils.lua:417: in function 'get_os_command_output'
	...data/lazy/telescope.nvim/lua/telescope/builtin/__git.lua:470: in function 'set_opts_cwd'
	...data/lazy/telescope.nvim/lua/telescope/builtin/__git.lua:493: in function 'v'
	...-data/lazy/telescope.nvim/lua/telescope/builtin/init.lua:584: in function <...-data/lazy/telescope.nvim/lua/telescope/builtin/init.lua:543>
	...lazy/telescope.nvim/lua/telescope/builtin/__internal.lua:113: in function 'run_replace_or_original'
	...im-data/lazy/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func'
	...nvim-data/lazy/telescope.nvim/lua/telescope/mappings.lua:257: in function <...nvim-data/lazy/telescope.nvim/lua/telescope/mappings.lua:256>

command = "git"
pid = "ENOENT: no such file or directory"

It's not a bug of plenary. Git executables are not found.

Make sure git is discoverable on your $PATH. Try:

!git
!which git
:echo $PATH

Hi there, I just confirmed this issue on my neovim config.

-- Only load those plugins if the current buffer is a git repository
local is_inside_git_repo = function()
  local git_dir = vim.fn.finddir(".git", vim.fn.expand("%:p:h") .. ";")
  return vim.fn.isdirectory(git_dir) ~= 0
end

return {
  {
    "akinsho/git-conflict.nvim",
    opts = {
      highlights = { -- They must have background color, otherwise the default color will be used
        incoming = "DiffAdd",
        current = "DiffText",
      },
    },
    lazy = not is_inside_git_repo(),
    keys = {
      -- Chose conflict
      { "<leader>gfc", "<cmd>GitConflictChooseTheirs<cr>", desc = "Git Conflict Choose - Incoming changes" },
      { "<leader>gfo", "<cmd>GitConflictChooseOurs<cr>", desc = "Git Conflict Choose - Current changes" },
      { "<leader>gfb", "<cmd>GitConflictChooseBoth<cr>", desc = "Git Conflict Choose - Both changes" },
      -- Navigate conflicts
      { "<leader>gfl", "<cmd>GitConflictListQf<cr>", desc = "Git Conflict Quicklist" },
      { "<leader>gfp", "<cmd>GitConflictPrevConflict<cr>", desc = "Git Conflict Previous" },
      { "<leader>gfp", "<cmd>GitConflictPrevConflict<cr>", desc = "Git Conflict Previous" },
    },
  },
  {
    "sindrets/diffview.nvim",
    lazy = not is_inside_git_repo(),
    cmd = "DiffviewOpen",
    keys = { { "<leader>gd", "<cmd>DiffviewOpen<cr>", desc = "Open Git Diff" } },
  },
}

I am using NVIM v0.10.0-dev-4c32927 by the way.

❯ vi --version
NVIM v0.10.0-dev-4c32927
Build type: RelWithDebInfo
LuaJIT 2.1.1697887905
Run "nvim -V1 -v" for more info

The issue you report is invalid, it's probably not a bug of plenary. Do you have git installed? I doubt so. Make sure :echo exepath("git") returns a valid git path.

Git seems ok. What's the precise error you are getting? Could you please post a detailed stacktrace and error messages?

The issue you report is invalid, it's probably not a bug of plenary. Do you have git installed? I doubt so. Make sure :echo exepath("git") returns a valid git path.

Is this valid? @wookayin
Image from Gyazo

Z3rio commented

The issue you report is invalid, it's probably not a bug of plenary. Do you have git installed? I doubt so. Make sure :echo exepath("git") returns a valid git path.

I use git daily, so I most definitely have it installed.
Yet, such an error occurred for me (scroll up)

I haven't used :Telescope git_files for a while now though, so I cant say if it is still occurring or not.

The error message just says that git does not exist in your %PATH%.

Z3rio commented

The error message just says that git does not exist in your %PATH%.

Here you go, this video should prove the opposite :)
Weird why it would say that though.

https://streamable.com/f6frff
(Seems like streamable's quality is a bit bad, I'll replace this with a youtube link once that has processed)

its probably related to the set cwd C:\\qbcore\\fx-data\\resources\\[zerio], it might be that [ causes problems ] similar can be said about the original issue (_raw_cwd = "//192.168.89.144/c$/readlsassmem",)

local Job = require("plenary.job")

local stdout, ret = Job:new({
  command = "git",
  args = { "rev-parse", "--show-toplevel" },
  cwd = "__insert_cwd_here__",
}):sync()

print(ret)

mind running this script above? just create a test.lua file and then do source % it does git rev-parse --show-toplevel and then it returns the return code for it.

so it should be 0 in a repo and 128 (at least for me on linux) if not a repo.

Make sure to set the cwd to a path without and then with [...] if only the later fails we know the culprit. (also please make sure the path exists)

Sadly i dont have a windows machine so i can do testing, so yeah