Karsten Hopp c81484
To: vim_dev@googlegroups.com
Karsten Hopp c81484
Subject: Patch 7.3.499
Karsten Hopp c81484
Fcc: outbox
Karsten Hopp c81484
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp c81484
Mime-Version: 1.0
Karsten Hopp c81484
Content-Type: text/plain; charset=UTF-8
Karsten Hopp c81484
Content-Transfer-Encoding: 8bit
Karsten Hopp c81484
------------
Karsten Hopp c81484
Karsten Hopp c81484
Patch 7.3.499
Karsten Hopp c81484
Problem:    When using any interface language when Vim is waiting for a child
Karsten Hopp c81484
	    process it gets confused by a child process started through the
Karsten Hopp c81484
	    interface.
Karsten Hopp c81484
Solution:   Always used waitpid() instead of wait(). (Yasuhiro Matsumoto)
Karsten Hopp c81484
Files:      src/os_unix.c
Karsten Hopp c81484
Karsten Hopp c81484
Karsten Hopp c81484
*** ../vim-7.3.498/src/os_unix.c	2012-02-05 22:51:27.000000000 +0100
Karsten Hopp c81484
--- src/os_unix.c	2012-04-20 15:47:17.000000000 +0200
Karsten Hopp c81484
***************
Karsten Hopp c81484
*** 3734,3757 ****
Karsten Hopp c81484
  
Karsten Hopp c81484
      while (wait_pid != child)
Karsten Hopp c81484
      {
Karsten Hopp c81484
! # ifdef _THREAD_SAFE
Karsten Hopp c81484
! 	/* Ugly hack: when compiled with Python threads are probably
Karsten Hopp c81484
! 	 * used, in which case wait() sometimes hangs for no obvious
Karsten Hopp c81484
! 	 * reason.  Use waitpid() instead and loop (like the GUI). */
Karsten Hopp c81484
! #  ifdef __NeXT__
Karsten Hopp c81484
  	wait_pid = wait4(child, status, WNOHANG, (struct rusage *)0);
Karsten Hopp c81484
! #  else
Karsten Hopp c81484
  	wait_pid = waitpid(child, status, WNOHANG);
Karsten Hopp c81484
! #  endif
Karsten Hopp c81484
  	if (wait_pid == 0)
Karsten Hopp c81484
  	{
Karsten Hopp c81484
  	    /* Wait for 1/100 sec before trying again. */
Karsten Hopp c81484
  	    mch_delay(10L, TRUE);
Karsten Hopp c81484
  	    continue;
Karsten Hopp c81484
  	}
Karsten Hopp c81484
- # else
Karsten Hopp c81484
- 	wait_pid = wait(status);
Karsten Hopp c81484
- # endif
Karsten Hopp c81484
  	if (wait_pid <= 0
Karsten Hopp c81484
  # ifdef ECHILD
Karsten Hopp c81484
  		&& errno == ECHILD
Karsten Hopp c81484
--- 3734,3754 ----
Karsten Hopp c81484
  
Karsten Hopp c81484
      while (wait_pid != child)
Karsten Hopp c81484
      {
Karsten Hopp c81484
! 	/* When compiled with Python threads are probably used, in which case
Karsten Hopp c81484
! 	 * wait() sometimes hangs for no obvious reason.  Use waitpid()
Karsten Hopp c81484
! 	 * instead and loop (like the GUI). Also needed for other interfaces,
Karsten Hopp c81484
! 	 * they might call system(). */
Karsten Hopp c81484
! # ifdef __NeXT__
Karsten Hopp c81484
  	wait_pid = wait4(child, status, WNOHANG, (struct rusage *)0);
Karsten Hopp c81484
! # else
Karsten Hopp c81484
  	wait_pid = waitpid(child, status, WNOHANG);
Karsten Hopp c81484
! # endif
Karsten Hopp c81484
  	if (wait_pid == 0)
Karsten Hopp c81484
  	{
Karsten Hopp c81484
  	    /* Wait for 1/100 sec before trying again. */
Karsten Hopp c81484
  	    mch_delay(10L, TRUE);
Karsten Hopp c81484
  	    continue;
Karsten Hopp c81484
  	}
Karsten Hopp c81484
  	if (wait_pid <= 0
Karsten Hopp c81484
  # ifdef ECHILD
Karsten Hopp c81484
  		&& errno == ECHILD
Karsten Hopp c81484
*** ../vim-7.3.498/src/version.c	2012-04-20 13:46:02.000000000 +0200
Karsten Hopp c81484
--- src/version.c	2012-04-20 15:54:05.000000000 +0200
Karsten Hopp c81484
***************
Karsten Hopp c81484
*** 716,717 ****
Karsten Hopp c81484
--- 716,719 ----
Karsten Hopp c81484
  {   /* Add new patch number below this line */
Karsten Hopp c81484
+ /**/
Karsten Hopp c81484
+     499,
Karsten Hopp c81484
  /**/
Karsten Hopp c81484
Karsten Hopp c81484
-- 
Karsten Hopp c81484
It's not hard to meet expenses, they're everywhere.
Karsten Hopp c81484
Karsten Hopp c81484
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp c81484
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp c81484
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp c81484
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///