comparison src/testdir/test_signals.vim @ 26825:3c1dcb63f579 v8.2.3941

patch 8.2.3941: SIGTSTP is not handled Commit: https://github.com/vim/vim/commit/ab16ad33ba10dd12ff6660fa57b88f1a30ddd8ba Author: dbivolaru <dbivolaru@jacobs-alumni.de> Date: Wed Dec 29 19:41:47 2021 +0000 patch 8.2.3941: SIGTSTP is not handled Problem: SIGTSTP is not handled. Solution: Handle SIGTSTP like pressing CTRL-Z. (closes https://github.com/vim/vim/issues/9422)
author Bram Moolenaar <Bram@vim.org>
date Wed, 29 Dec 2021 20:45:03 +0100
parents 826a6406ea7b
children b4c111ea83b1
comparison
equal deleted inserted replaced
26824:6dccddda8bbc 26825:3c1dcb63f579
101 exe 'silent !kill -s INT ' .. pid_vim 101 exe 'silent !kill -s INT ' .. pid_vim
102 call term_sendkeys(buf, ":call setline(1, 'INTERUPTED')\n") 102 call term_sendkeys(buf, ":call setline(1, 'INTERUPTED')\n")
103 call WaitForAssert({-> assert_equal('INTERUPTED', term_getline(buf, 1))}) 103 call WaitForAssert({-> assert_equal('INTERUPTED', term_getline(buf, 1))})
104 104
105 call StopVimInTerminal(buf) 105 call StopVimInTerminal(buf)
106 endfunc
107
108 " Test signal TSTP. Handler sets got_tstp.
109 func Test_signal_TSTP()
110 CheckRunVimInTerminal
111 if !HasSignal('TSTP')
112 throw 'Skipped: TSTP signal not supported'
113 endif
114
115 " Skip the test when running with valgrind as signal TSTP is not received
116 " somehow by Vim when running with valgrind.
117 let cmd = GetVimCommand()
118 if cmd =~ 'valgrind'
119 throw 'Skipped: cannot test signal TSTP with valgrind'
120 endif
121
122 " If test fails once, it can leave temporary files and trying to rerun
123 " the test would then fail again if they are not deleted first.
124 call delete('.Xsig_TERM.swp')
125 call delete('XsetupAucmd')
126 call delete('XautoOut')
127 let lines =<< trim END
128 au VimSuspend * call writefile(["VimSuspend triggered"], "XautoOut", "as")
129 au VimResume * call writefile(["VimResume triggered"], "XautoOut", "as")
130 END
131 call writefile(lines, 'XsetupAucmd')
132
133 let buf = RunVimInTerminal('-S XsetupAucmd Xsig_TERM', {'rows': 6})
134 let pid_vim = term_getjob(buf)->job_info().process
135
136 call term_sendkeys(buf, ":call setline(1, 'foo')\n")
137 call WaitForAssert({-> assert_equal('foo', term_getline(buf, 1))})
138
139 call assert_false(filereadable('Xsig_TERM'))
140
141 " After TSTP the file is not saved (same function as ^Z)
142 exe 'silent !kill -s TSTP ' .. pid_vim
143 call WaitForAssert({-> assert_true(filereadable('.Xsig_TERM.swp'))})
144
145 " We resume after the suspend
146 exe 'silent !kill -s CONT ' .. pid_vim
147 exe 'silent !sleep 0.006'
148
149 call StopVimInTerminal(buf)
150
151 let result = readfile('XautoOut')
152 call assert_equal(["VimSuspend triggered", "VimResume triggered"], result)
153
154 %bwipe!
155 call delete('.Xsig_TERM.swp')
156 call delete('XsetupAucmd')
157 call delete('XautoOut')
106 endfunc 158 endfunc
107 159
108 " Test a deadly signal. 160 " Test a deadly signal.
109 " 161 "
110 " There are several deadly signals: SISEGV, SIBUS, SIGTERM... 162 " There are several deadly signals: SISEGV, SIBUS, SIGTERM...