aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/system_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-02-02 21:52:01 +0800
committerGitHub <noreply@github.com>2024-02-02 21:52:01 +0800
commit9b7cf4f0beb35b640846f92ac522372967ca6695 (patch)
treef127d978d11c38311880c2acab94b05be8ee00e2 /test/functional/lua/system_spec.lua
parente98decf9a68e41b09214aa60b77d0db29b7d648a (diff)
downloadrneovim-9b7cf4f0beb35b640846f92ac522372967ca6695.tar.gz
rneovim-9b7cf4f0beb35b640846f92ac522372967ca6695.tar.bz2
rneovim-9b7cf4f0beb35b640846f92ac522372967ca6695.zip
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().
Diffstat (limited to 'test/functional/lua/system_spec.lua')
-rw-r--r--test/functional/lua/system_spec.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/functional/lua/system_spec.lua b/test/functional/lua/system_spec.lua
index bae8322b43..cb561f0771 100644
--- a/test/functional/lua/system_spec.lua
+++ b/test/functional/lua/system_spec.lua
@@ -104,4 +104,18 @@ describe('vim.system', function()
assert(signal == 2)
]])
end)
+
+ it('SystemObj:wait() does not process non-fast events #27292', function()
+ eq(
+ false,
+ exec_lua([[
+ _G.processed = false
+ local cmd = vim.system({ 'sleep', '1' })
+ vim.schedule(function() _G.processed = true end)
+ cmd:wait()
+ return _G.processed
+ ]])
+ )
+ eq(true, exec_lua([[return _G.processed]]))
+ end)
end)