mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 9.0.1377: job_status() may return "dead" if the process parent changed
Problem: job_status() may return "dead" if the process parent changed. Solution: Call mch_process_running() to check if the job is still alive.
This commit is contained in:
@@ -5863,10 +5863,17 @@ mch_job_status(job_T *job)
|
|||||||
# endif
|
# endif
|
||||||
if (wait_pid == -1)
|
if (wait_pid == -1)
|
||||||
{
|
{
|
||||||
|
int waitpid_errno = errno;
|
||||||
|
if (waitpid_errno == ECHILD && mch_process_running(job->jv_pid))
|
||||||
|
// The process is alive, but it was probably reparented (for
|
||||||
|
// example by ptrace called by a debugger like lldb or gdb).
|
||||||
|
// Note: This assumes that process IDs are not reused.
|
||||||
|
return "run";
|
||||||
|
|
||||||
// process must have exited
|
// process must have exited
|
||||||
if (job->jv_status < JOB_ENDED)
|
if (job->jv_status < JOB_ENDED)
|
||||||
ch_log(job->jv_channel, "Job no longer exists: %s",
|
ch_log(job->jv_channel, "Job no longer exists: %s",
|
||||||
strerror(errno));
|
strerror(waitpid_errno));
|
||||||
goto return_dead;
|
goto return_dead;
|
||||||
}
|
}
|
||||||
if (wait_pid == 0)
|
if (wait_pid == 0)
|
||||||
|
@@ -695,6 +695,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 */
|
||||||
|
/**/
|
||||||
|
1377,
|
||||||
/**/
|
/**/
|
||||||
1376,
|
1376,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user