summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_channel.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-01-31 15:52:11 +0100
committerBram Moolenaar <Bram@vim.org>2019-01-31 15:52:11 +0100
commitb3051ce82f2e8af95ce3b6a41867f70aee5ecc82 (patch)
tree52f4e45e4fc81f14d02414e5c9e18036ed026dcf /src/testdir/test_channel.vim
parent221cd9f4dd866503777b2fffa721c1403716ad63 (diff)
patch 8.1.0863: cannot see what signal caused a job to endv8.1.0863
Problem: Cannot see what signal caused a job to end. Solution: Add "termsig" to job_info(). (Ozaki Kiichi, closes #3786)
Diffstat (limited to 'src/testdir/test_channel.vim')
-rw-r--r--src/testdir/test_channel.vim24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index f81701a076..2aef3e1dc4 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -2002,3 +2002,27 @@ func Test_raw_large_data()
unlet g:out
endtry
endfunc
+
+func Test_job_exitval_and_termsig()
+ if !has('unix')
+ return
+ endif
+
+ " Terminate job normally
+ let cmd = ['echo']
+ let job = job_start(cmd)
+ call WaitForAssert({-> assert_equal("dead", job_status(job))})
+ let info = job_info(job)
+ call assert_equal(0, info.exitval)
+ call assert_equal("", info.termsig)
+
+ " Terminate job by signal
+ let cmd = ['sleep', '10']
+ let job = job_start(cmd)
+ sleep 10m
+ call job_stop(job)
+ call WaitForAssert({-> assert_equal("dead", job_status(job))})
+ let info = job_info(job)
+ call assert_equal(-1, info.exitval)
+ call assert_equal("term", info.termsig)
+endfunc