]>
Commit | Line | Data |
---|---|---|
c86c2677 ER |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.1.288 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.1.288 (after 7.1.281) | |
11 | Problem: Cscope still leaves behind temp files when using gvim. | |
12 | Solution: When getting the ECHILD error loop for a while until cscope exits. | |
13 | (Dominique Pelle) | |
14 | Files: if_cscope.c | |
15 | ||
16 | ||
17 | *** ../vim-7.1.287/src/if_cscope.c Sun Mar 16 16:02:47 2008 | |
18 | --- src/if_cscope.c Tue Mar 25 21:34:23 2008 | |
19 | *************** | |
20 | *** 2130,2135 **** | |
21 | --- 2130,2136 ---- | |
22 | } | |
23 | #if defined(UNIX) | |
24 | { | |
25 | + int waitpid_errno; | |
26 | int pstat; | |
27 | pid_t pid; | |
28 | ||
29 | *************** | |
30 | *** 2145,2150 **** | |
31 | --- 2146,2152 ---- | |
32 | ||
33 | /* Block until cscope exits or until timer expires */ | |
34 | pid = waitpid(csinfo[i].pid, &pstat, 0); | |
35 | + waitpid_errno = errno; | |
36 | ||
37 | /* cancel pending alarm if still there and restore signal */ | |
38 | alarm(0); | |
39 | *************** | |
40 | *** 2158,2163 **** | |
41 | --- 2160,2166 ---- | |
42 | for (waited = 0; waited < 40; ++waited) | |
43 | { | |
44 | pid = waitpid(csinfo[i].pid, &pstat, WNOHANG); | |
45 | + waitpid_errno = errno; | |
46 | if (pid != 0) | |
47 | break; /* break unless the process is still running */ | |
48 | mch_delay(50, FALSE); /* sleep 50 ms */ | |
49 | *************** | |
50 | *** 2170,2177 **** | |
51 | */ | |
52 | if (pid < 0 && csinfo[i].pid > 1) | |
53 | { | |
54 | ! kill(csinfo[i].pid, SIGKILL); | |
55 | ! (void)waitpid(csinfo[i].pid, &pstat, 0); | |
56 | } | |
57 | } | |
58 | #else /* !UNIX */ | |
59 | --- 2173,2212 ---- | |
60 | */ | |
61 | if (pid < 0 && csinfo[i].pid > 1) | |
62 | { | |
63 | ! # ifdef ECHILD | |
64 | ! int alive = TRUE; | |
65 | ! | |
66 | ! if (waitpid_errno == ECHILD) | |
67 | ! { | |
68 | ! /* | |
69 | ! * When using 'vim -g', vim is forked and cscope process is | |
70 | ! * no longer a child process but a sibling. So waitpid() | |
71 | ! * fails with errno being ECHILD (No child processes). | |
72 | ! * Don't send SIGKILL to cscope immediately but wait | |
73 | ! * (polling) for it to exit normally as result of sending | |
74 | ! * the "q" command, hence giving it a chance to clean up | |
75 | ! * its temporary files. | |
76 | ! */ | |
77 | ! int waited; | |
78 | ! | |
79 | ! sleep(0); | |
80 | ! for (waited = 0; waited < 40; ++waited) | |
81 | ! { | |
82 | ! /* Check whether cscope process is still alive */ | |
83 | ! if (kill(csinfo[i].pid, 0) != 0) | |
84 | ! { | |
85 | ! alive = FALSE; /* cscope process no longer exists */ | |
86 | ! break; | |
87 | ! } | |
88 | ! mch_delay(50, FALSE); /* sleep 50ms */ | |
89 | ! } | |
90 | ! } | |
91 | ! if (alive) | |
92 | ! # endif | |
93 | ! { | |
94 | ! kill(csinfo[i].pid, SIGKILL); | |
95 | ! (void)waitpid(csinfo[i].pid, &pstat, 0); | |
96 | ! } | |
97 | } | |
98 | } | |
99 | #else /* !UNIX */ | |
100 | *** ../vim-7.1.287/src/version.c Tue Apr 1 13:10:45 2008 | |
101 | --- src/version.c Tue Apr 1 14:28:42 2008 | |
102 | *************** | |
103 | *** 668,669 **** | |
104 | --- 668,671 ---- | |
105 | { /* Add new patch number below this line */ | |
106 | + /**/ | |
107 | + 288, | |
108 | /**/ | |
109 | ||
110 | -- | |
111 | hundred-and-one symptoms of being an internet addict: | |
112 | 204. You're being audited because you mailed your tax return to the IRC. | |
113 | ||
114 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
115 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
116 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
117 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |