diff options
Diffstat (limited to 'src/callproc.c')
| -rw-r--r-- | src/callproc.c | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/src/callproc.c b/src/callproc.c index ee0872b5562..59067040fd9 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -1154,6 +1154,14 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L | |||
| 1154 | #ifdef WINDOWSNT | 1154 | #ifdef WINDOWSNT |
| 1155 | prepare_standard_handles (in, out, err, handles); | 1155 | prepare_standard_handles (in, out, err, handles); |
| 1156 | set_process_dir (SDATA (current_dir)); | 1156 | set_process_dir (SDATA (current_dir)); |
| 1157 | /* Spawn the child. (See ntproc.c:Spawnve). */ | ||
| 1158 | cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env); | ||
| 1159 | reset_standard_handles (in, out, err, handles); | ||
| 1160 | if (cpid == -1) | ||
| 1161 | /* An error occurred while trying to spawn the process. */ | ||
| 1162 | report_file_error ("Spawning child process", Qnil); | ||
| 1163 | return cpid; | ||
| 1164 | |||
| 1157 | #else /* not WINDOWSNT */ | 1165 | #else /* not WINDOWSNT */ |
| 1158 | /* Make sure that in, out, and err are not actually already in | 1166 | /* Make sure that in, out, and err are not actually already in |
| 1159 | descriptors zero, one, or two; this could happen if Emacs is | 1167 | descriptors zero, one, or two; this could happen if Emacs is |
| @@ -1192,36 +1200,17 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L | |||
| 1192 | emacs_close (out); | 1200 | emacs_close (out); |
| 1193 | if (err != in && err != out) | 1201 | if (err != in && err != out) |
| 1194 | emacs_close (err); | 1202 | emacs_close (err); |
| 1195 | #endif /* not MSDOS */ | ||
| 1196 | #endif /* not WINDOWSNT */ | ||
| 1197 | 1203 | ||
| 1198 | #if defined(USG) | 1204 | #if defined(USG) |
| 1199 | #ifndef SETPGRP_RELEASES_CTTY | 1205 | #ifndef SETPGRP_RELEASES_CTTY |
| 1200 | setpgrp (); /* No arguments but equivalent in this case */ | 1206 | setpgrp (); /* No arguments but equivalent in this case */ |
| 1201 | #endif | 1207 | #endif |
| 1202 | #else | 1208 | #else /* not USG */ |
| 1203 | setpgrp (pid, pid); | 1209 | setpgrp (pid, pid); |
| 1204 | #endif /* USG */ | 1210 | #endif /* not USG */ |
| 1205 | 1211 | ||
| 1206 | #ifdef MSDOS | ||
| 1207 | pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env); | ||
| 1208 | xfree (pwd_var); | ||
| 1209 | if (pid == -1) | ||
| 1210 | /* An error occurred while trying to run the subprocess. */ | ||
| 1211 | report_file_error ("Spawning child process", Qnil); | ||
| 1212 | return pid; | ||
| 1213 | #else /* not MSDOS */ | ||
| 1214 | #ifdef WINDOWSNT | ||
| 1215 | /* Spawn the child. (See ntproc.c:Spawnve). */ | ||
| 1216 | cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env); | ||
| 1217 | reset_standard_handles (in, out, err, handles); | ||
| 1218 | if (cpid == -1) | ||
| 1219 | /* An error occurred while trying to spawn the process. */ | ||
| 1220 | report_file_error ("Spawning child process", Qnil); | ||
| 1221 | return cpid; | ||
| 1222 | #else /* not WINDOWSNT */ | ||
| 1223 | /* setpgrp_of_tty is incorrect here; it uses input_fd. */ | 1212 | /* setpgrp_of_tty is incorrect here; it uses input_fd. */ |
| 1224 | EMACS_SET_TTY_PGRP (0, &pid); | 1213 | tcsetpgrp (0, pid); |
| 1225 | 1214 | ||
| 1226 | /* execvp does not accept an environment arg so the only way | 1215 | /* execvp does not accept an environment arg so the only way |
| 1227 | to pass this environment is to set environ. Our caller | 1216 | to pass this environment is to set environ. Our caller |
| @@ -1233,8 +1222,16 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L | |||
| 1233 | emacs_write (1, new_argv[0], strlen (new_argv[0])); | 1222 | emacs_write (1, new_argv[0], strlen (new_argv[0])); |
| 1234 | emacs_write (1, "\n", 1); | 1223 | emacs_write (1, "\n", 1); |
| 1235 | _exit (1); | 1224 | _exit (1); |
| 1236 | #endif /* not WINDOWSNT */ | 1225 | |
| 1237 | #endif /* not MSDOS */ | 1226 | #else /* MSDOS */ |
| 1227 | pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env); | ||
| 1228 | xfree (pwd_var); | ||
| 1229 | if (pid == -1) | ||
| 1230 | /* An error occurred while trying to run the subprocess. */ | ||
| 1231 | report_file_error ("Spawning child process", Qnil); | ||
| 1232 | return pid; | ||
| 1233 | #endif /* MSDOS */ | ||
| 1234 | #endif /* not WINDOWSNT */ | ||
| 1238 | } | 1235 | } |
| 1239 | 1236 | ||
| 1240 | #ifndef WINDOWSNT | 1237 | #ifndef WINDOWSNT |
| @@ -1519,7 +1516,7 @@ void | |||
| 1519 | syms_of_callproc (void) | 1516 | syms_of_callproc (void) |
| 1520 | { | 1517 | { |
| 1521 | #ifdef DOS_NT | 1518 | #ifdef DOS_NT |
| 1522 | Qbuffer_file_type = intern ("buffer-file-type"); | 1519 | Qbuffer_file_type = intern_c_string ("buffer-file-type"); |
| 1523 | staticpro (&Qbuffer_file_type); | 1520 | staticpro (&Qbuffer_file_type); |
| 1524 | #endif /* DOS_NT */ | 1521 | #endif /* DOS_NT */ |
| 1525 | 1522 | ||
| @@ -1609,5 +1606,3 @@ See `setenv' and `getenv'. */); | |||
| 1609 | defsubr (&Scall_process_region); | 1606 | defsubr (&Scall_process_region); |
| 1610 | } | 1607 | } |
| 1611 | 1608 | ||
| 1612 | /* arch-tag: 769b8045-1df7-4d2b-8968-e3fb49017f95 | ||
| 1613 | (do not change this comment) */ | ||