From 7e8b431d3f67e5b167bc238899521715e1b324d8 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Thu, 29 Oct 2015 07:46:39 -0300 Subject: tui: Fix abort when stdout and stderr are not tty. The abort came from using libuv tty handle on non-tty fd. Use uv_pipe_t in these cases. Also add simple test for this case. --- test/functional/terminal/tui_spec.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/functional') diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index d38bedcd4a..0c4b80fdd2 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -149,3 +149,27 @@ describe('tui', function() ]]) end) end) + +describe('tui with non-tty file descriptors', function() + before_each(helpers.clear) + + after_each(function() + os.remove('testF') -- ensure test file is removed + end) + + it('can handle pipes as stdout and stderr', function() + local screen = thelpers.screen_setup(0, '"'..helpers.nvim_prog..' -u NONE -i NONE --cmd \'set noswapfile\' --cmd \'normal iabc\' > /dev/null 2>&1 && cat testF && rm testF"') + screen:set_default_attr_ids({}) + screen:set_default_attr_ignore(true) + feed(':w testF\n:q\n') + screen:expect([[ + :w testF | + :q | + abc | + | + [Program exited, press any key to close] | + | + -- TERMINAL -- | + ]]) + end) +end) -- cgit