Mercurial > vim
comparison src/os_unix.c @ 2600:d982226b7aaa v7.3.023
updated for version 7.3.023
Problem: External program may hang when it tries to write to the tty.
Solution: Don't close the slave tty until after the child exits. (Nikola
Knezevic)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 13 Oct 2010 16:22:09 +0200 |
parents | 538cd3220874 |
children | 758822790b43 |
comparison
equal
deleted
inserted
replaced
2599:8aa94f8080bd | 2600:d982226b7aaa |
---|---|
4166 # endif | 4166 # endif |
4167 | 4167 |
4168 # ifdef FEAT_GUI | 4168 # ifdef FEAT_GUI |
4169 if (pty_master_fd >= 0) | 4169 if (pty_master_fd >= 0) |
4170 { | 4170 { |
4171 close(pty_slave_fd); /* close slave side of pty */ | |
4172 fromshell_fd = pty_master_fd; | 4171 fromshell_fd = pty_master_fd; |
4173 toshell_fd = dup(pty_master_fd); | 4172 toshell_fd = dup(pty_master_fd); |
4174 } | 4173 } |
4175 else | 4174 else |
4176 # endif | 4175 # endif |
4634 && errno == ECHILD | 4633 && errno == ECHILD |
4635 # endif | 4634 # endif |
4636 ) | 4635 ) |
4637 break; | 4636 break; |
4638 } | 4637 } |
4638 | |
4639 # ifdef FEAT_GUI | |
4640 /* Close slave side of pty. Only do this after the child has | |
4641 * exited, otherwise the child may hang when it tries to write on | |
4642 * the pty. */ | |
4643 if (pty_master_fd >= 0) | |
4644 close(pty_slave_fd); | |
4645 # endif | |
4639 | 4646 |
4640 /* Make sure the child that writes to the external program is | 4647 /* Make sure the child that writes to the external program is |
4641 * dead. */ | 4648 * dead. */ |
4642 if (wpid > 0) | 4649 if (wpid > 0) |
4643 kill(wpid, SIGKILL); | 4650 kill(wpid, SIGKILL); |