mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
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.
This commit is contained in:
@@ -4474,21 +4474,27 @@ job_status({job}) *job_status()* *E916*
|
|||||||
job_stop({job} [, {how}]) *job_stop()*
|
job_stop({job} [, {how}]) *job_stop()*
|
||||||
Stop the {job}. This can also be used to signal the job.
|
Stop the {job}. This can also be used to signal the job.
|
||||||
|
|
||||||
When {how} is omitted or is "term" the job will be terminated
|
When {how} is omitted or is "term" the job will be terminated.
|
||||||
normally. For Unix SIGTERM is sent. For MS-Windows
|
For Unix SIGTERM is sent. On MS-Windows the job will be
|
||||||
CTRL_BREAK will be sent. This goes to the process group, thus
|
terminated forcedly (there is no "gentle" way).
|
||||||
children may also be affected.
|
This goes to the process group, thus children may also be
|
||||||
|
affected.
|
||||||
|
|
||||||
Other values for Unix:
|
Effect for Unix:
|
||||||
"hup" Unix: SIGHUP
|
"term" SIGTERM (default)
|
||||||
"quit" Unix: SIGQUIT
|
"hup" SIGHUP
|
||||||
"kill" Unix: SIGKILL (strongest way to stop)
|
"quit" SIGQUIT
|
||||||
number Unix: signal with that number
|
"int" SIGINT
|
||||||
|
"kill" SIGKILL (strongest way to stop)
|
||||||
|
number signal with that number
|
||||||
|
|
||||||
Other values for MS-Windows:
|
Effect for MS-Windows:
|
||||||
"int" Windows: CTRL_C
|
"term" terminate process forcedly (default)
|
||||||
"kill" Windows: terminate process forcedly
|
"hup" CTRL_BREAK
|
||||||
Others Windows: 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
|
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
|
that when the job is "sh -c command" it affects both the shell
|
||||||
|
@@ -5202,12 +5202,14 @@ mch_stop_job(job_T *job, char_u *how)
|
|||||||
int sig = -1;
|
int sig = -1;
|
||||||
pid_t job_pid;
|
pid_t job_pid;
|
||||||
|
|
||||||
if (STRCMP(how, "hup") == 0)
|
if (*how == NUL || STRCMP(how, "term") == 0)
|
||||||
sig = SIGHUP;
|
|
||||||
else if (*how == NUL || STRCMP(how, "term") == 0)
|
|
||||||
sig = SIGTERM;
|
sig = SIGTERM;
|
||||||
|
else if (STRCMP(how, "hup") == 0)
|
||||||
|
sig = SIGHUP;
|
||||||
else if (STRCMP(how, "quit") == 0)
|
else if (STRCMP(how, "quit") == 0)
|
||||||
sig = SIGQUIT;
|
sig = SIGQUIT;
|
||||||
|
else if (STRCMP(how, "int") == 0)
|
||||||
|
sig = SIGINT;
|
||||||
else if (STRCMP(how, "kill") == 0)
|
else if (STRCMP(how, "kill") == 0)
|
||||||
sig = SIGKILL;
|
sig = SIGKILL;
|
||||||
else if (isdigit(*how))
|
else if (isdigit(*how))
|
||||||
|
@@ -5141,10 +5141,9 @@ mch_job_status(job_T *job)
|
|||||||
int
|
int
|
||||||
mch_stop_job(job_T *job, char_u *how)
|
mch_stop_job(job_T *job, char_u *how)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret;
|
||||||
int ctrl_c = STRCMP(how, "int") == 0;
|
|
||||||
|
|
||||||
if (STRCMP(how, "kill") == 0)
|
if (STRCMP(how, "term") == 0 || STRCMP(how, "kill") == 0 || *how == NUL)
|
||||||
{
|
{
|
||||||
if (job->jv_job_object != NULL)
|
if (job->jv_job_object != NULL)
|
||||||
return TerminateJobObject(job->jv_job_object, 0) ? OK : FAIL;
|
return TerminateJobObject(job->jv_job_object, 0) ? OK : FAIL;
|
||||||
@@ -5155,9 +5154,9 @@ mch_stop_job(job_T *job, char_u *how)
|
|||||||
if (!AttachConsole(job->jv_proc_info.dwProcessId))
|
if (!AttachConsole(job->jv_proc_info.dwProcessId))
|
||||||
return FAIL;
|
return FAIL;
|
||||||
ret = GenerateConsoleCtrlEvent(
|
ret = GenerateConsoleCtrlEvent(
|
||||||
ctrl_c ? CTRL_C_EVENT : CTRL_BREAK_EVENT,
|
STRCMP(how, "int") == 0 ? CTRL_C_EVENT : CTRL_BREAK_EVENT,
|
||||||
job->jv_proc_info.dwProcessId)
|
job->jv_proc_info.dwProcessId)
|
||||||
? OK : FAIL;
|
? OK : FAIL;
|
||||||
FreeConsole();
|
FreeConsole();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@@ -748,6 +748,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1418,
|
||||||
/**/
|
/**/
|
||||||
1417,
|
1417,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user