]> granicus.if.org Git - vim/commitdiff
patch 8.2.0238: MS-Windows: job_stop() results in exit value zero v8.2.0238
authorBram Moolenaar <Bram@vim.org>
Mon, 10 Feb 2020 20:32:19 +0000 (21:32 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 10 Feb 2020 20:32:19 +0000 (21:32 +0100)
Problem:    MS-Windows: job_stop() results in exit value zero.
Solution:   Call TerminateJobObject() with -1 instead of 0. (Yasuhiro
            Matsumoto, closes #5150, closes #5614)

src/os_win32.c
src/testdir/test_channel.vim
src/version.c

index 7dc37a111493966d993918f76e64ad3ba113c640..2594aeea56a7048948161041c12f55f478517bc4 100644 (file)
@@ -5384,9 +5384,9 @@ mch_signal_job(job_T *job, char_u *how)
        {
            if (job->jv_channel != NULL && job->jv_channel->ch_anonymous_pipe)
                job->jv_channel->ch_killing = TRUE;
-           return TerminateJobObject(job->jv_job_object, 0) ? OK : FAIL;
+           return TerminateJobObject(job->jv_job_object, -1) ? OK : FAIL;
        }
-       return terminate_all(job->jv_proc_info.hProcess, 0) ? OK : FAIL;
+       return terminate_all(job->jv_proc_info.hProcess, -1) ? OK : FAIL;
     }
 
     if (!AttachConsole(job->jv_proc_info.dwProcessId))
index c2068105bf68333c162ab33c4ab6bfddffb720bb..ebcd76e0ffef836c70fda74a6a3dc346076df7bb 100644 (file)
@@ -1991,3 +1991,18 @@ func Test_job_start_fails()
   " this was leaking memory
   call assert_fails("call job_start([''])", "E474:")
 endfunc
+
+func Test_issue_5150()
+  let g:job = job_start('grep foo', {})
+  call job_stop(g:job)
+  sleep 10m
+  call assert_equal(-1, job_info(g:job).exitval)
+  let g:job = job_start('grep foo', {})
+  call job_stop(g:job, 'term')
+  sleep 10m
+  call assert_equal(-1, job_info(g:job).exitval)
+  let g:job = job_start('grep foo', {})
+  call job_stop(g:job, 'kill')
+  sleep 10m
+  call assert_equal(-1, job_info(g:job).exitval)
+endfunc
index 7c48e0bdc8e9c41ee447d9cf6d95e35d564a78b1..61a9f958a4c7aaad1438e20d485f5bb3bdec9719 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    238,
 /**/
     237,
 /**/