/processes.nvim

Primary LanguageLuaMIT LicenseMIT

processes.nvim

This package currently has one function, kill_tree.

I chose to namespace it under brandoncc because processes seems like a name that might collide with other packages or even something native eventually.

Installation

Install using your favorite plugin manager. For example in vim-plug:

Plug 'brandoncc/processes.nvim'

Usage

lua require("brandoncc.processes").kill_tree(<pid>, [wait_time_in_seconds])

API

kill_tree

Usage

The first argument is a pid that you would like to kill, along with any children/grandchildren/etc.

The second argument is the options hash which can have the following structure:

  • timeout: number
  • signals: a list of kill signals to send, after the process exits, no more signals will be sent to that process
  • log_signals: a boolean stating whether you would like to see messages echoed each time a signal is sent to a process.

The options table can be omitted if you would like to use the defaults.

require("processes").killtree(pid, {
  timeout = 5,                  -- default value
  signals = { 'TERM', 'KILL' }, -- default value
  log_signals: false,           -- default value
})

Processes are killed one a time, not in parallel.

Contributing

If you have ideas how this package can be improved and extended, please open an issue so we can discuss them. Ideas are welcome!