diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-09-04 11:30:16 +0100 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2023-09-05 17:10:01 +0100 |
commit | 6d5f12efd286c684de8608c07bb0f76a9d594b5b (patch) | |
tree | aaf460e24971f3b03d29e20b965cfebc18b17fad /runtime/lua/vim/_editor.lua | |
parent | a44521f46e6f79171d034e5cce1a4dc266d23e49 (diff) | |
download | rneovim-6d5f12efd286c684de8608c07bb0f76a9d594b5b.tar.gz rneovim-6d5f12efd286c684de8608c07bb0f76a9d594b5b.tar.bz2 rneovim-6d5f12efd286c684de8608c07bb0f76a9d594b5b.zip |
fix(vim.system): make timeout work properly
Mimic the behaviour of timeout(1) from coreutils.
Diffstat (limited to 'runtime/lua/vim/_editor.lua')
-rw-r--r-- | runtime/lua/vim/_editor.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index 96ac379368..ba0345cdd5 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -107,7 +107,8 @@ vim.log = { --- Handle output from stdout. When passed as a function must have the signature `fun(err: string, data: string)`. --- Defaults to `true`. --- - text: (boolean) Handle stdout and stderr as text. Replaces `\r\n` with `\n`. ---- - timeout: (integer) +--- - timeout: (integer) Run the command with a time limit. Upon timeout the process is sent the +--- TERM signal (15) and the exit code is set to 124. --- - detach: (boolean) If true, spawn the child process in a detached state - this will make it --- a process group leader, and will effectively enable the child to keep running after the --- parent exits. Note that the child process will still keep the parent's event loop alive @@ -118,13 +119,14 @@ vim.log = { --- --- @return SystemObj Object with the fields: --- - pid (integer) Process ID ---- - wait (fun(timeout: integer|nil): SystemCompleted) +--- - wait (fun(timeout: integer|nil): SystemCompleted) Wait for the process to complete. Upon +--- timeout the process is sent the KILL signal (9) and the exit code is set to 124. --- - SystemCompleted is an object with the fields: --- - code: (integer) --- - signal: (integer) --- - stdout: (string), nil if stdout argument is passed --- - stderr: (string), nil if stderr argument is passed ---- - kill (fun(signal: integer)) +--- - kill (fun(signal: integer|string)) --- - write (fun(data: string|nil)) Requires `stdin=true`. Pass `nil` to close the stream. --- - is_closing (fun(): boolean) function vim.system(cmd, opts, on_exit) |