From 5939c357431f8e43853ad80b03303167f39763df Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 24 Sep 2022 12:50:45 +0100 Subject: patch 9.0.0569: cannot easily get out when using "vim file | grep word" Problem: Cannot easily get out when using "vim file | grep word". Solution: Without changes let CTRL-C exit Vim. Otherwise give a message on stderr. (closes #11209) --- src/testdir/test_startup.vim | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/testdir/test_startup.vim') diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim index 6cc62ad015..7995cd2e5b 100644 --- a/src/testdir/test_startup.vim +++ b/src/testdir/test_startup.vim @@ -1109,6 +1109,29 @@ func Test_not_a_term() call delete('Xvimout') endfunc +" Test quitting with CTRL-C when output is redirected. +func Test_redirect_Ctrl_C() + CheckUnix + CheckNotGui + CheckRunVimInTerminal + + let buf = Run_shell_in_terminal({}) + " Wait for the shell to display a prompt + call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) + + call term_sendkeys(buf, GetVimProg() .. " | grep word\") + call WaitForAssert({-> assert_match("Output is not to a terminal", getline(1, 4)->join())}) + " wait for the hard coded delay, otherwise the CTRL-C interrupts startup + sleep 2 + call term_sendkeys(buf, "\") + sleep 100m + call term_sendkeys(buf, "exit\") + call WaitForAssert({-> assert_equal('dead', job_status(g:job))}) + + exe buf . 'bwipe!' + unlet g:job +endfunc + " Test for the "-w scriptout" argument func Test_w_arg() -- cgit v1.2.3