Commit Graph

19 Commits

Author SHA1 Message Date
58df501913 docs: api, pack, events, develop 2025-07-10 21:50:46 -04:00
4eebc46930 fix(vim.system): env=nil passes env=nil to uv.spawn
731e616a79 made it so passing `{env = nil, clear_env = true }` would
pass `{env = {}}` to `vim.uv.spawn`.

However this is not what `clear_env` is (arguably) supposed to do.
If `env=nil` then that implies the uses wants `vim.uv.spawn()` to use
the default environment. Adding `clear_env = true` simply prevents
`NVIM` (the base environment) from being added.

Fixes #34730
2025-07-02 17:01:29 +01:00
731e616a79 fix(vim.system): clear_env=true gives an invalid env to uv.spawn #33955
Problem:
In setup_env, some needed logic is bypassed when clear_env=true.

Solution:
Drop the early return in setup_env().

Co-authored-by: BirdeeHub <birdee@localhost>
2025-06-25 15:15:19 -07:00
532610388b fix(vim.system): improve error message when cwd does not exist
Problem:
vim.uv.spawn will emit ENOENT for either when the cmd or cwd do not
exist and does not tell you which.

Solution:
If an error occurs, check if cwd was supplied and included in the error
message if it does not exist.
2025-05-29 13:59:33 +01:00
223ac7782e fix(vim.system): unclear non-executable message #33455
Problem:
When a command is not found or not executable, the error message gives
no indication about what command was actually tried.

Solution:
Always append the command name to the error message.

BEFORE:

    E5108: Error executing lua …/_system.lua:248: ENOENT: no such file or directory

AFTER:

    E5108: Error executing lua …/_system.lua:249: ENOENT: no such file or directory: "foo"

fix #33445
2025-04-16 05:06:39 -07:00
540def7d2c test(system_spec): check for .git dir before using git (#31458) 2024-12-05 09:13:22 +00:00
734dba04d1 fix(vim.system): close pipe handles after process handle
Fixes #30846
2024-12-04 14:44:40 +00:00
07db909eb5 docs: misc (#31138)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2024-11-21 06:50:30 +08:00
ad3472e291 fix(vim.system): resolve executable paths on windows
Fixes #31107
2024-11-08 16:29:44 +00:00
e5c174421d test: support upvalues in exec_lua 2024-09-21 16:04:09 +01:00
052498ed42 test: improve test conventions
Specifically, functions that are run in the context of the test runner
are put in module `test/testutil.lua` while the functions that are run
in the context of the test session are put in
`test/functional/testnvim.lua`.

Closes https://github.com/neovim/neovim/issues/27004.
2024-04-23 18:17:04 +02:00
81fc27124b refactor(test): inject after_each differently 2024-04-10 15:53:50 +01:00
7035125b2b test: improve test conventions
Work on https://github.com/neovim/neovim/issues/27004.
2024-04-08 22:51:00 +02:00
9b7cf4f0be fix(vim.system): don't process non-fast events during wait() (#27300)
Problem:
Processing non-fast events during SystemObj:wait() may cause two pieces
of code to interfere with each other, and is different from jobwait().

Solution:
Don't process non-fast events during SystemObj:wait().
2024-02-02 21:52:01 +08:00
04f2f864e2 refactor: format test/* 2024-01-03 02:09:29 +01:00
80d1333b73 refactor(vim.system): factor out on_exit handling 2023-09-05 17:10:04 +01:00
6d5f12efd2 fix(vim.system): make timeout work properly
Mimic the behaviour of timeout(1) from coreutils.
2023-09-05 17:10:01 +01:00
a44521f46e fix(vim.system): let on_exit handle cleanup after kill
Fixes #25000
2023-09-05 10:18:26 +01:00
c0952e62fd feat(lua): add vim.system()
feat(lua): add vim.system()

Problem:

  Handling system commands in Lua is tedious and error-prone:
  - vim.fn.jobstart() is vimscript and comes with all limitations attached to typval.
  - vim.loop.spawn is too low level

Solution:

  Add vim.system().
  Partly inspired by Python's subprocess module
  Does not expose any libuv objects.
2023-06-07 13:52:23 +01:00