diff options
| author | Eli Zaretskii | 1998-04-21 11:14:24 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 1998-04-21 11:14:24 +0000 |
| commit | c17c425043f0878ca9bf33ecc44da4101768dd14 (patch) | |
| tree | 0366698c1846fbb795f904a7358b7dfd4fb69ab9 | |
| parent | e52f2f255e132396179cbe0de499df764b39d88f (diff) | |
| download | emacs-c17c425043f0878ca9bf33ecc44da4101768dd14.tar.gz emacs-c17c425043f0878ca9bf33ecc44da4101768dd14.zip | |
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
(child_setup) [MSDOS]: Call run_msdos_command here.
(child_setup) [DOS_NT]: Get past drive letter in pwd. Don't call
close_load_descs, since we are not in a vfork.
| -rw-r--r-- | src/callproc.c | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/src/callproc.c b/src/callproc.c index a09649c639a..3b1417bd540 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -522,14 +522,11 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") | |||
| 522 | current_dir = ENCODE_FILE (current_dir); | 522 | current_dir = ENCODE_FILE (current_dir); |
| 523 | 523 | ||
| 524 | #ifdef MSDOS /* MW, July 1993 */ | 524 | #ifdef MSDOS /* MW, July 1993 */ |
| 525 | /* ??? Someone who knows MSDOG needs to check whether this properly | 525 | /* Note that on MSDOS `child_setup' actually returns the child process |
| 526 | closes all descriptors that it opens. | ||
| 527 | |||
| 528 | Note that run_msdos_command() actually returns the child process | ||
| 529 | exit status, not its PID, so we assign it to `synch_process_retcode' | 526 | exit status, not its PID, so we assign it to `synch_process_retcode' |
| 530 | below. */ | 527 | below. */ |
| 531 | pid = run_msdos_command (new_argv, current_dir, | 528 | pid = child_setup (filefd, outfilefd, fd_error, (char **) new_argv, |
| 532 | filefd, outfilefd, fd_error); | 529 | 0, current_dir); |
| 533 | 530 | ||
| 534 | /* Record that the synchronous process exited and note its | 531 | /* Record that the synchronous process exited and note its |
| 535 | termination status. */ | 532 | termination status. */ |
| @@ -876,8 +873,6 @@ static int relocate_fd (); | |||
| 876 | Therefore, the superior process must save and restore the value | 873 | Therefore, the superior process must save and restore the value |
| 877 | of environ around the vfork and the call to this function. | 874 | of environ around the vfork and the call to this function. |
| 878 | 875 | ||
| 879 | ENV is the environment for the subprocess. | ||
| 880 | |||
| 881 | SET_PGRP is nonzero if we should put the subprocess into a separate | 876 | SET_PGRP is nonzero if we should put the subprocess into a separate |
| 882 | process group. | 877 | process group. |
| 883 | 878 | ||
| @@ -893,10 +888,6 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) | |||
| 893 | int set_pgrp; | 888 | int set_pgrp; |
| 894 | Lisp_Object current_dir; | 889 | Lisp_Object current_dir; |
| 895 | { | 890 | { |
| 896 | #ifdef MSDOS | ||
| 897 | /* The MSDOS port of gcc cannot fork, vfork, ... so we must call system | ||
| 898 | instead. */ | ||
| 899 | #else /* not MSDOS */ | ||
| 900 | char **env; | 891 | char **env; |
| 901 | char *pwd_var; | 892 | char *pwd_var; |
| 902 | #ifdef WINDOWSNT | 893 | #ifdef WINDOWSNT |
| @@ -919,7 +910,11 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) | |||
| 919 | /* Close Emacs's descriptors that this process should not have. */ | 910 | /* Close Emacs's descriptors that this process should not have. */ |
| 920 | close_process_descs (); | 911 | close_process_descs (); |
| 921 | #endif | 912 | #endif |
| 913 | /* DOS_NT isn't in a vfork, so if we are in the middle of load-file, | ||
| 914 | we will lose if we call close_load_descs here. */ | ||
| 915 | #ifndef DOS_NT | ||
| 922 | close_load_descs (); | 916 | close_load_descs (); |
| 917 | #endif | ||
| 923 | 918 | ||
| 924 | /* Note that use of alloca is always safe here. It's obvious for systems | 919 | /* Note that use of alloca is always safe here. It's obvious for systems |
| 925 | that do not have true vfork or that have true (stack) alloca. | 920 | that do not have true vfork or that have true (stack) alloca. |
| @@ -938,7 +933,7 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) | |||
| 938 | if (!IS_DIRECTORY_SEP (temp[i - 1])) temp[i++] = DIRECTORY_SEP; | 933 | if (!IS_DIRECTORY_SEP (temp[i - 1])) temp[i++] = DIRECTORY_SEP; |
| 939 | temp[i] = 0; | 934 | temp[i] = 0; |
| 940 | 935 | ||
| 941 | #ifndef WINDOWSNT | 936 | #ifndef DOS_NT |
| 942 | /* We can't signal an Elisp error here; we're in a vfork. Since | 937 | /* We can't signal an Elisp error here; we're in a vfork. Since |
| 943 | the callers check the current directory before forking, this | 938 | the callers check the current directory before forking, this |
| 944 | should only return an error if the directory's permissions | 939 | should only return an error if the directory's permissions |
| @@ -948,6 +943,15 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) | |||
| 948 | _exit (errno); | 943 | _exit (errno); |
| 949 | #endif | 944 | #endif |
| 950 | 945 | ||
| 946 | #ifdef DOS_NT | ||
| 947 | /* Get past the drive letter, so that d:/ is left alone. */ | ||
| 948 | if (i > 2 && IS_DEVICE_SEP (temp[1]) && IS_DIRECTORY_SEP (temp[2])) | ||
| 949 | { | ||
| 950 | temp += 2; | ||
| 951 | i -= 2; | ||
| 952 | } | ||
| 953 | #endif | ||
| 954 | |||
| 951 | /* Strip trailing slashes for PWD, but leave "/" and "//" alone. */ | 955 | /* Strip trailing slashes for PWD, but leave "/" and "//" alone. */ |
| 952 | while (i > 2 && IS_DIRECTORY_SEP (temp[i - 1])) | 956 | while (i > 2 && IS_DIRECTORY_SEP (temp[i - 1])) |
| 953 | temp[--i] = 0; | 957 | temp[--i] = 0; |
| @@ -1032,6 +1036,7 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) | |||
| 1032 | err = relocate_fd (err, 3); | 1036 | err = relocate_fd (err, 3); |
| 1033 | } | 1037 | } |
| 1034 | 1038 | ||
| 1039 | #ifndef MSDOS | ||
| 1035 | close (0); | 1040 | close (0); |
| 1036 | close (1); | 1041 | close (1); |
| 1037 | close (2); | 1042 | close (2); |
| @@ -1042,6 +1047,7 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) | |||
| 1042 | close (in); | 1047 | close (in); |
| 1043 | close (out); | 1048 | close (out); |
| 1044 | close (err); | 1049 | close (err); |
| 1050 | #endif /* not MSDOS */ | ||
| 1045 | #endif /* not WINDOWSNT */ | 1051 | #endif /* not WINDOWSNT */ |
| 1046 | 1052 | ||
| 1047 | #if defined(USG) && !defined(BSD_PGRPS) | 1053 | #if defined(USG) && !defined(BSD_PGRPS) |
| @@ -1058,6 +1064,13 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) | |||
| 1058 | something missing here; | 1064 | something missing here; |
| 1059 | #endif /* vipc */ | 1065 | #endif /* vipc */ |
| 1060 | 1066 | ||
| 1067 | #ifdef MSDOS | ||
| 1068 | pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env); | ||
| 1069 | if (pid == -1) | ||
| 1070 | /* An error occurred while trying to run the subprocess. */ | ||
| 1071 | report_file_error ("Spawning child process", Qnil); | ||
| 1072 | return pid; | ||
| 1073 | #else /* not MSDOS */ | ||
| 1061 | #ifdef WINDOWSNT | 1074 | #ifdef WINDOWSNT |
| 1062 | /* Spawn the child. (See ntproc.c:Spawnve). */ | 1075 | /* Spawn the child. (See ntproc.c:Spawnve). */ |
| 1063 | cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env); | 1076 | cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env); |