Plenary.job:shutdown(code, signal) not terminating process
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Reproduce the report using the mentioned config.lua setup, plenary.job, and strace, then inspect the Job:shutdown entry point and its process-handling behavior. Compare shutdown with vim.loop.kill and verify that the requested signal reaches the started process and that on_exit reports the resulting termination.
Written by the indexing model from the issue text.
Description
Maybe I'm not understanding the concept of Job or shutdown, but I expect the started process to finish when I shutdown the job with the shutdown function (or at least send the signal given as parameter), but it's not doing either for some processes.
I have set up a simple configuration to reproduce this issue
- Create the following file,
config.lua
--- use your own way to load plugins
vim.fn['plug#begin']('~/.vim/plugged')
vim.fn["plug#"]('nvim-lua/plenary.nvim')
vim.fn['plug#end']()
--- @type Job
local Job = require("plenary.job")
MyJob = Job:new({
command = "mycommand.sh",
on_exit = vim.schedule_wrap(function(self, code, signal)
print(string.format("PID: %d | code: %d | signal: %d", self.pid, code, signal))
end),
})
MyJob:start()
- Start neovim with
neovim -u config.lua - Get the process PID with
:lua print(MyJob.pid) - Watch the process system calls with
sudo strace -p <pid>where is the pid obtained in the previous step. - Shutdown the process in neovim with
:lua MyJob:shutdown(0, 3). I expect the process to receive a SIGQUIT(3) signal but nothing appears in thestraceoutput. It doesn't matter if you runshutdownwithout arguments or with another signals, still no output instrace. However,shutdownexecuteson_exitcorrectly and prints the followingPID: <pid> | code: 0 | signal: 3. - To verify that
straceshould output something when it receives a signal, runkill -n 3 <pid>

Alternatively, you could also use:lua vim.loop.kill(MyJob.pid, 3)
Am I doing something wrong? What should I use in order to stop the process instead?
Just for some context, this is where I'm trying to use it, right now using vim.loop.kill as a workaround (in that code I'm killing a process started by the job instead), but I'm expecting the following to work
function M.stop()
if job then
job:shutdown() -- or maybe use a signal to terminate the process
end
I'm getting the following behaviour instead: (almost a copy of this comment in a PR for flutter-tools.nvim
Execute a command to start the job: (The first one is the job, second one the child process)

Both processes are in the process tree, bash and dart (the parent of zsh is my terminal)

Executing the stop lua function inside neovim executes the on_exit function, but the processes are still there (both of them actually, same tree)

After exiting the processes, instead of terminating, are detached and moved to the root (systemd):

- Dominant language
- Lua
- Stars
- 3.5k
- Forks
- 340
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nvim-lua/plenary.nvim
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
nvim-lua/plenary.nvim#682 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
nvim-lua/plenary.nvim#680 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
nvim-lua/plenary.nvim#675 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 28/100
nvim-lua/plenary.nvim#672 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
nvim-lua/plenary.nvim#671 · 1 comment ·
All issues in nvim-lua/plenary.nvim
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 1/5 Under an hour Newbie friendliness 94/100
codymikol/multiverse.nvim#320 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Good First Issue
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100