To: vim_dev@googlegroups.com Subject: Patch 8.0.0071 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0071 Problem: Exit value from a shell command is wrong. (Hexchain Tong) Solution: Do not check for ended jobs while waiting for a shell command. (ichizok, closes #1196) Files: src/os_unix.c *** ../vim-8.0.0070/src/os_unix.c 2016-11-04 20:35:27.352945991 +0100 --- src/os_unix.c 2016-11-07 22:35:15.711318293 +0100 *************** *** 238,243 **** --- 238,247 ---- /* volatile because it is used in signal handler deathtrap(). */ static volatile int in_mch_delay = FALSE; /* sleeping in mch_delay() */ + #if defined(FEAT_JOB_CHANNEL) && !defined(USE_SYSTEM) + static int dont_check_job_ended = 0; + #endif + static int curr_tmode = TMODE_COOK; /* contains current terminal mode */ #ifdef USE_XSMP *************** *** 4485,4491 **** catch_signals(SIG_IGN, SIG_ERR); catch_int_signal(); UNBLOCK_SIGNALS(&curset); ! /* * For the GUI we redirect stdin, stdout and stderr to our window. * This is also used to pipe stdin/stdout to/from the external --- 4489,4497 ---- catch_signals(SIG_IGN, SIG_ERR); catch_int_signal(); UNBLOCK_SIGNALS(&curset); ! # ifdef FEAT_JOB_CHANNEL ! ++dont_check_job_ended; ! # endif /* * For the GUI we redirect stdin, stdout and stderr to our window. * This is also used to pipe stdin/stdout to/from the external *************** *** 5030,5035 **** --- 5036,5045 ---- wait4pid(wpid, NULL); } + # ifdef FEAT_JOB_CHANNEL + --dont_check_job_ended; + # endif + /* * Set to raw mode right now, otherwise a CTRL-C after * catch_signals() will kill Vim. *************** *** 5363,5368 **** --- 5373,5386 ---- pid_t wait_pid = 0; job_T *job; + # ifndef USE_SYSTEM + /* Do not do this when waiting for a shell command to finish, we would get + * the exit value here (and discard it), the exit value obtained there + * would then be wrong. */ + if (dont_check_job_ended > 0) + return NULL; + # endif + # ifdef __NeXT__ wait_pid = wait4(-1, &status, WNOHANG, (struct rusage *)0); # else *** ../vim-8.0.0070/src/version.c 2016-11-07 22:13:29.171894387 +0100 --- src/version.c 2016-11-07 22:36:59.566637376 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 71, /**/ -- An operatingsystem is just a name you give to the rest of bloating idiosyncratic machine-based-features you left out of your editor. (author unknown) /// 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 ///