To: vim_dev@googlegroups.com Subject: Patch 7.4.1418 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1418 Problem: job_stop() on MS-Windows does not really stop the job. Solution: Make the default to stop the job forcefully. (Ken Takata) Make MS-Windows and Unix more similar. Files: src/os_win32.c, src/os_unix.c, runtime/doc/eval.txt *** ../vim-7.4.1417/src/os_win32.c 2016-02-23 19:33:57.429544837 +0100 --- src/os_win32.c 2016-02-25 20:51:11.441142000 +0100 *************** *** 5141,5150 **** int mch_stop_job(job_T *job, char_u *how) { ! int ret = 0; ! int ctrl_c = STRCMP(how, "int") == 0; ! if (STRCMP(how, "kill") == 0) { if (job->jv_job_object != NULL) return TerminateJobObject(job->jv_job_object, 0) ? OK : FAIL; --- 5141,5149 ---- int mch_stop_job(job_T *job, char_u *how) { ! int ret; ! if (STRCMP(how, "term") == 0 || STRCMP(how, "kill") == 0 || *how == NUL) { if (job->jv_job_object != NULL) return TerminateJobObject(job->jv_job_object, 0) ? OK : FAIL; *************** *** 5155,5163 **** if (!AttachConsole(job->jv_proc_info.dwProcessId)) return FAIL; ret = GenerateConsoleCtrlEvent( ! ctrl_c ? CTRL_C_EVENT : CTRL_BREAK_EVENT, ! job->jv_proc_info.dwProcessId) ! ? OK : FAIL; FreeConsole(); return ret; } --- 5154,5162 ---- if (!AttachConsole(job->jv_proc_info.dwProcessId)) return FAIL; ret = GenerateConsoleCtrlEvent( ! STRCMP(how, "int") == 0 ? CTRL_C_EVENT : CTRL_BREAK_EVENT, ! job->jv_proc_info.dwProcessId) ! ? OK : FAIL; FreeConsole(); return ret; } *** ../vim-7.4.1417/src/os_unix.c 2016-02-18 22:17:36.105244535 +0100 --- src/os_unix.c 2016-02-25 20:52:42.532189790 +0100 *************** *** 5202,5213 **** int sig = -1; pid_t job_pid; ! if (STRCMP(how, "hup") == 0) ! sig = SIGHUP; ! else if (*how == NUL || STRCMP(how, "term") == 0) sig = SIGTERM; else if (STRCMP(how, "quit") == 0) sig = SIGQUIT; else if (STRCMP(how, "kill") == 0) sig = SIGKILL; else if (isdigit(*how)) --- 5202,5215 ---- int sig = -1; pid_t job_pid; ! if (*how == NUL || STRCMP(how, "term") == 0) sig = SIGTERM; + else if (STRCMP(how, "hup") == 0) + sig = SIGHUP; else if (STRCMP(how, "quit") == 0) sig = SIGQUIT; + else if (STRCMP(how, "int") == 0) + sig = SIGINT; else if (STRCMP(how, "kill") == 0) sig = SIGKILL; else if (isdigit(*how)) *** ../vim-7.4.1417/runtime/doc/eval.txt 2016-02-23 17:13:56.869032413 +0100 --- runtime/doc/eval.txt 2016-02-25 20:47:22.275537801 +0100 *************** *** 4394,4414 **** job_stop({job} [, {how}]) *job_stop()* Stop the {job}. This can also be used to signal the job. ! When {how} is omitted or is "term" the job will be terminated ! normally. For Unix SIGTERM is sent. For MS-Windows ! CTRL_BREAK will be sent. This goes to the process group, thus ! children may also be affected. ! ! Other values for Unix: ! "hup" Unix: SIGHUP ! "quit" Unix: SIGQUIT ! "kill" Unix: SIGKILL (strongest way to stop) ! number Unix: signal with that number ! ! Other values for MS-Windows: ! "int" Windows: CTRL_C ! "kill" Windows: terminate process forcedly ! Others Windows: CTRL_BREAK On Unix the signal is sent to the process group. This means that when the job is "sh -c command" it affects both the shell --- 4474,4500 ---- job_stop({job} [, {how}]) *job_stop()* Stop the {job}. This can also be used to signal the job. ! When {how} is omitted or is "term" the job will be terminated. ! For Unix SIGTERM is sent. On MS-Windows the job will be ! terminated forcedly (there is no "gentle" way). ! This goes to the process group, thus children may also be ! affected. ! ! Effect for Unix: ! "term" SIGTERM (default) ! "hup" SIGHUP ! "quit" SIGQUIT ! "int" SIGINT ! "kill" SIGKILL (strongest way to stop) ! number signal with that number ! ! Effect for MS-Windows: ! "term" terminate process forcedly (default) ! "hup" CTRL_BREAK ! "quit" CTRL_BREAK ! "int" CTRL_C ! "kill" terminate process forcedly ! Others CTRL_BREAK On Unix the signal is sent to the process group. This means that when the job is "sh -c command" it affects both the shell *** ../vim-7.4.1417/src/version.c 2016-02-25 20:37:31.877711824 +0100 --- src/version.c 2016-02-25 20:49:00.082515239 +0100 *************** *** 750,751 **** --- 750,753 ---- { /* Add new patch number below this line */ + /**/ + 1418, /**/ -- To the optimist, the glass is half full. To the pessimist, the glass is half empty. To the engineer, the glass is twice as big as it needs to be. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///