comparison src/os_unix.c @ 2992:ee17ee712512 v7.3.268

updated for version 7.3.268 Problem: Vim freezes when executing an external command with zsh. Solution: Use O_NOCTTY both in the master and slave. (Bjorn Winckler)
author Bram Moolenaar <bram@vim.org>
date Thu, 04 Aug 2011 19:36:52 +0200
parents bf283e37792b
children 7f4f5ca70dbd
comparison
equal deleted inserted replaced
2991:df5d4bbe02ff 2992:ee17ee712512
3887 * If the slave can't be opened, close the master pty. 3887 * If the slave can't be opened, close the master pty.
3888 */ 3888 */
3889 if (p_guipty && !(options & (SHELL_READ|SHELL_WRITE))) 3889 if (p_guipty && !(options & (SHELL_READ|SHELL_WRITE)))
3890 { 3890 {
3891 pty_master_fd = OpenPTY(&tty_name); /* open pty */ 3891 pty_master_fd = OpenPTY(&tty_name); /* open pty */
3892 if (pty_master_fd >= 0 && ((pty_slave_fd = 3892 if (pty_master_fd >= 0)
3893 open(tty_name, O_RDWR | O_EXTRA, 0)) < 0))
3894 { 3893 {
3895 close(pty_master_fd); 3894 /* Leaving out O_NOCTTY may lead to waitpid() always returning
3896 pty_master_fd = -1; 3895 * 0 on Mac OS X 10.7 thereby causing freezes. Let's assume
3896 * adding O_NOCTTY always works when defined. */
3897 #ifdef O_NOCTTY
3898 pty_slave_fd = open(tty_name, O_RDWR | O_NOCTTY | O_EXTRA, 0);
3899 #else
3900 pty_slave_fd = open(tty_name, O_RDWR | O_EXTRA, 0);
3901 #endif
3902 if (pty_slave_fd < 0)
3903 {
3904 close(pty_master_fd);
3905 pty_master_fd = -1;
3906 }
3897 } 3907 }
3898 } 3908 }
3899 /* 3909 /*
3900 * If not opening a pty or it didn't work, try using pipes. 3910 * If not opening a pty or it didn't work, try using pipes.
3901 */ 3911 */