diff src/testdir/test_channel.vim @ 15711:287104a1d51e v8.1.0863

patch 8.1.0863: cannot see what signal caused a job to end commit https://github.com/vim/vim/commit/b3051ce82f2e8af95ce3b6a41867f70aee5ecc82 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 31 15:52:11 2019 +0100 patch 8.1.0863: cannot see what signal caused a job to end Problem: Cannot see what signal caused a job to end. Solution: Add "termsig" to job_info(). (Ozaki Kiichi, closes https://github.com/vim/vim/issues/3786)
author Bram Moolenaar <Bram@vim.org>
date Thu, 31 Jan 2019 16:00:06 +0100
parents 772e72b046a3
children 208bf8b36075
line wrap: on
line diff
--- 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