Comments (8)
Alright, I'll give that a shot when I get a chance
from overseer.nvim.
Hmmmm...this is very interesting. I haven't had any such issues; all the long-running tasks that I use are terminated when I exit neovim. I know that the processes started with termopen()
are slightly different from those started with jobstart()
, and in general there has been some iteration on how Neovim handles child processes.
Would it be possible to come up with a minimal script or example where I can reproduce the issue?
from overseer.nvim.
Ok, so far I have only been able to reproduce it on a very specific case: a make command running a docker command.
The task is killed if run make with a non-docker command, and also when running the docker command directly. However, if I run a make command that runs a docker command, and close nvim, neither the make process nor the docker process is killed.
Tried it with a simple make recipe that runs docker logs -f
on a container.
from overseer.nvim.
Well I have some additional information. When vim exits it sends all of its open terminals (opened with termopen) a SIGHUP. Turns out, make
ignores SIGHUP, though I can't find any documentation about this. This isn't so uncommon, as daemon processes often use SIGHUP to trigger reloading the config from disk, or similar. When you stop the task directly in overseer (with jobstop) it sends a SIGHUP, followed after a short pause by SIGTERM, which does successfully kill it (I believe that is this KILL_TIMEOUT_MS at work). Interestingly, processes started with jobstart are killed with SIGTERM on exit. This appears to be an intentional difference in Neovim's handling of PTY child processes. Another interesting inconsistency: when I open a terminal with :terminal
and run the make command directly, the process receives a SIGHUP signal followed by another SIGHUP sent by the kernel on vim exit, which in this case does correctly kill the process. This last behavior I do not understand.
I've put in some logic that explicitly calls jobstop()
when vim is exiting. In most cases, this doesn't change anything. If you have a task like make
that swallows the SIGHUP, it will cause Neovim to hang for about 2 seconds on exit as it cleans up the children. I think this is an acceptable tradeoff for now.
Long-term, I'm thinking of making a different strategy that directly uses uv.spawn
instead of termopen()
. That should give us more direct control over handling the child processes.
from overseer.nvim.
While investigating a strategy that uses uv.spawn
I determined that it doesn't make much sense. It would be better to use jobstart()
because that handles a lot of the process management and cross-platform logic that we would need anyway. Both of the strategies (terminal & jobstart) should use the above logic of waiting for 2 seconds if necessary and then killing child processes.
Please re-open if the original issue is not resolved.
from overseer.nvim.
The change kills the make
command, but since what I run is a docker container, the container keeps running on exit.
I don't think there is a way to stop the container as well, so it can be left as-is.
from overseer.nvim.
Related, although I don't think this is strictly the purview of overseer.nvim. Adding comments here in case it sparks additional inspiration.
One of my .vscode/tasks.json entries is:
{
"label": "Devenv",
"type": "shell",
"command": "devenv",
"args": ["up"]
}
which starts devenv. When I exit neovim, the process that devenv spawns (in my case: postgres) is still running and I have to manually pkill -f postgres
to kill it.
I've resorted to a project-local "plugin" in .nvim/devenv.lua:
local ok, overseer = pcall(require, "overseer")
if ok and not vim.env.NVIM_DISABLE_DEVENV_EXT then
vim.api.nvim_create_user_command("Devenv", function()
local devenv = overseer.new_task({
cmd = "devenv up",
components = { "default" },
})
devenv:start()
vim.api.nvim_create_autocmd("VimLeavePre", {
callback = function()
-- devenv:stop() -- kills devenv but not postgres
overseer.new_task({
cmd = "pkill -f postgres"
}):start()
end,
})
end, { desc = "devenv" })
end
from overseer.nvim.
+1 for adding a way to notify about running tasks on quit
from overseer.nvim.
Related Issues (20)
- bug: `$eslint-stylish` triggers error HOT 2
- feature request: ToggleTerm strategy - go to previous window on terminal close
- feature request: Is there any way to create custom strategy?
- feature request: strategy to read output from a log file instead of stdout and stderr
- bug: The sidebar buffer doesn't render after opening overseer before job start HOT 2
- bug: The scroll doesn't work with the toggleterm strategy when opening a preview
- feature request: Hidden vscode tasks HOT 3
- bug: Wrong autocomplete parameters with enum type
- bug: Orchestrator strategy undefined behavior HOT 1
- bug: open vsplit doesn't open (split) on the right HOT 1
- bug: telescope picker not shown but a fallback HOT 1
- feature request: [windows] remove (nonstandard?) escape sequences
- on_result_diagnostics_quickfix.set_empty_results not clearing diagnostics list HOT 1
- -
- bug: Targets from included Makefile only visible on first execution HOT 2
- bug: shell escape single quote HOT 1
- bug: How to keep in task log window HOT 2
- feature request: OverseerToggle!top
- How to change select multi parameters( TAB is no effect)
- bug: ephemeral docker containers do not stop HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from overseer.nvim.