aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core/channels_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-11-19 22:57:13 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-11-19 22:57:13 +0000
commit9be89f131f87608f224f0ee06d199fcd09d32176 (patch)
tree11022dcfa9e08cb4ac5581b16734196128688d48 /test/functional/core/channels_spec.lua
parentff7ed8f586589d620a806c3758fac4a47a8e7e15 (diff)
parent88085c2e80a7e3ac29aabb6b5420377eed99b8b6 (diff)
downloadrneovim-9be89f131f87608f224f0ee06d199fcd09d32176.tar.gz
rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.tar.bz2
rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/functional/core/channels_spec.lua')
-rw-r--r--test/functional/core/channels_spec.lua31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/functional/core/channels_spec.lua b/test/functional/core/channels_spec.lua
index a98e190a60..dee13d19ae 100644
--- a/test/functional/core/channels_spec.lua
+++ b/test/functional/core/channels_spec.lua
@@ -288,6 +288,37 @@ describe('channels', function()
eq({ 'notification', 'exit', { 3, 0 } }, next_msg())
end)
+ it('stdio channel works with stdout redirected to file #30509', function()
+ t.write_file(
+ 'Xstdio_write.vim',
+ [[
+ let chan = stdioopen({})
+ call chansend(chan, 'foo')
+ call chansend(chan, 'bar')
+ qall!
+ ]]
+ )
+ local fd = assert(vim.uv.fs_open('Xstdio_redir', 'w', 420))
+ local exit_code, exit_signal
+ local handle = vim.uv.spawn(nvim_prog, {
+ args = { '-u', 'NONE', '-i', 'NONE', '--headless', '-S', 'Xstdio_write.vim' },
+ -- Simulate shell redirection: "nvim ... > Xstdio_redir". #30509
+ stdio = { nil, fd, nil },
+ }, function(code, signal)
+ vim.uv.stop()
+ exit_code, exit_signal = code, signal
+ end)
+ finally(function()
+ handle:close()
+ vim.uv.fs_close(fd)
+ os.remove('Xstdio_write.vim')
+ os.remove('Xstdio_redir')
+ end)
+ vim.uv.run('default')
+ eq({ 0, 0 }, { exit_code, exit_signal })
+ eq('foobar', t.read_file('Xstdio_redir'))
+ end)
+
it('can use buffered output mode', function()
skip(fn.executable('grep') == 0, 'missing "grep" command')
source([[