diff options
author | Bram Moolenaar <bram@vim.org> | 2011-08-04 19:36:52 +0200 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2011-08-04 19:36:52 +0200 |
commit | 4c962153d17993ffa20a9201709730555bfcb03e (patch) | |
tree | 0a65644fe15ce4d60c6903425d42e5d9b238f870 | |
parent | f5148769de60221adaedeb3b99eee3022d83cfe8 (diff) | |
download | vim-4c962153d17993ffa20a9201709730555bfcb03e.tar.gz |
Problem: Vim freezes when executing an external command with zsh.
Solution: Use O_NOCTTY both in the master and slave. (Bjorn Winckler)
-rw-r--r-- | src/os_unix.c | 18 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index a3c4fd69..391af9cb 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3889,11 +3889,21 @@ mch_call_shell(cmd, options) if (p_guipty && !(options & (SHELL_READ|SHELL_WRITE))) { pty_master_fd = OpenPTY(&tty_name); /* open pty */ - if (pty_master_fd >= 0 && ((pty_slave_fd = - open(tty_name, O_RDWR | O_EXTRA, 0)) < 0)) + if (pty_master_fd >= 0) { - close(pty_master_fd); - pty_master_fd = -1; + /* Leaving out O_NOCTTY may lead to waitpid() always returning + * 0 on Mac OS X 10.7 thereby causing freezes. Let's assume + * adding O_NOCTTY always works when defined. */ +#ifdef O_NOCTTY + pty_slave_fd = open(tty_name, O_RDWR | O_NOCTTY | O_EXTRA, 0); +#else + pty_slave_fd = open(tty_name, O_RDWR | O_EXTRA, 0); +#endif + if (pty_slave_fd < 0) + { + close(pty_master_fd); + pty_master_fd = -1; + } } } /* diff --git a/src/version.c b/src/version.c index 6bddff0c..8adefc08 100644 --- a/src/version.c +++ b/src/version.c @@ -710,6 +710,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 268, +/**/ 267, /**/ 266, |