To: vim_dev@googlegroups.com Subject: Patch 9.0.1377 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1377 Problem: job_status() may return "dead" if the process parent changed. Solution: Call mch_process_running() to check if the job is still alive. Files: src/os_unix.c *** ../vim-9.0.1376/src/os_unix.c 2023-01-16 18:19:01.911301085 +0000 --- src/os_unix.c 2023-03-04 13:21:30.021789771 +0000 *************** *** 5863,5872 **** # endif if (wait_pid == -1) { // process must have exited if (job->jv_status < JOB_ENDED) ch_log(job->jv_channel, "Job no longer exists: %s", ! strerror(errno)); goto return_dead; } if (wait_pid == 0) --- 5873,5889 ---- # endif 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 if (job->jv_status < JOB_ENDED) ch_log(job->jv_channel, "Job no longer exists: %s", ! strerror(waitpid_errno)); goto return_dead; } if (wait_pid == 0) *** ../vim-9.0.1376/src/version.c 2023-03-03 21:11:49.057414112 +0000 --- src/version.c 2023-03-04 13:05:04.489292862 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1377, /**/ -- hundred-and-one symptoms of being an internet addict: 221. Your wife melts your keyboard in the oven. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///