diff options
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/process.c b/src/process.c index 9efefb1de73..15b4a23784e 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -2124,8 +2124,11 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 2124 | if (!EQ (p->command, Qt)) | 2124 | if (!EQ (p->command, Qt)) |
| 2125 | add_process_read_fd (inchannel); | 2125 | add_process_read_fd (inchannel); |
| 2126 | 2126 | ||
| 2127 | ptrdiff_t count = SPECPDL_INDEX (); | ||
| 2128 | |||
| 2127 | /* This may signal an error. */ | 2129 | /* This may signal an error. */ |
| 2128 | setup_process_coding_systems (process); | 2130 | setup_process_coding_systems (process); |
| 2131 | char *const *env = make_environment_block (current_dir); | ||
| 2129 | 2132 | ||
| 2130 | block_input (); | 2133 | block_input (); |
| 2131 | block_child_signal (&oldset); | 2134 | block_child_signal (&oldset); |
| @@ -2139,6 +2142,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 2139 | int volatile forkout_volatile = forkout; | 2142 | int volatile forkout_volatile = forkout; |
| 2140 | int volatile forkerr_volatile = forkerr; | 2143 | int volatile forkerr_volatile = forkerr; |
| 2141 | struct Lisp_Process *p_volatile = p; | 2144 | struct Lisp_Process *p_volatile = p; |
| 2145 | char *const *volatile env_volatile = env; | ||
| 2142 | 2146 | ||
| 2143 | #ifdef DARWIN_OS | 2147 | #ifdef DARWIN_OS |
| 2144 | /* Darwin doesn't let us run setsid after a vfork, so use fork when | 2148 | /* Darwin doesn't let us run setsid after a vfork, so use fork when |
| @@ -2163,6 +2167,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 2163 | forkout = forkout_volatile; | 2167 | forkout = forkout_volatile; |
| 2164 | forkerr = forkerr_volatile; | 2168 | forkerr = forkerr_volatile; |
| 2165 | p = p_volatile; | 2169 | p = p_volatile; |
| 2170 | env = env_volatile; | ||
| 2166 | 2171 | ||
| 2167 | pty_flag = p->pty_flag; | 2172 | pty_flag = p->pty_flag; |
| 2168 | 2173 | ||
| @@ -2254,9 +2259,11 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 2254 | if (forkerr < 0) | 2259 | if (forkerr < 0) |
| 2255 | forkerr = forkout; | 2260 | forkerr = forkout; |
| 2256 | #ifdef WINDOWSNT | 2261 | #ifdef WINDOWSNT |
| 2257 | pid = child_setup (forkin, forkout, forkerr, new_argv, 1, current_dir); | 2262 | pid = child_setup (forkin, forkout, forkerr, new_argv, env, |
| 2263 | SSDATA (current_dir)); | ||
| 2258 | #else /* not WINDOWSNT */ | 2264 | #else /* not WINDOWSNT */ |
| 2259 | child_setup (forkin, forkout, forkerr, new_argv, 1, current_dir); | 2265 | child_setup (forkin, forkout, forkerr, new_argv, env, |
| 2266 | SSDATA (current_dir)); | ||
| 2260 | #endif /* not WINDOWSNT */ | 2267 | #endif /* not WINDOWSNT */ |
| 2261 | } | 2268 | } |
| 2262 | 2269 | ||
| @@ -2271,6 +2278,9 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 2271 | unblock_child_signal (&oldset); | 2278 | unblock_child_signal (&oldset); |
| 2272 | unblock_input (); | 2279 | unblock_input (); |
| 2273 | 2280 | ||
| 2281 | /* Environment block no longer needed. */ | ||
| 2282 | unbind_to (count, Qnil); | ||
| 2283 | |||
| 2274 | if (pid < 0) | 2284 | if (pid < 0) |
| 2275 | report_file_errno (CHILD_SETUP_ERROR_DESC, Qnil, vfork_errno); | 2285 | report_file_errno (CHILD_SETUP_ERROR_DESC, Qnil, vfork_errno); |
| 2276 | else | 2286 | else |