aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy1992-12-12 15:31:32 +0000
committerJim Blandy1992-12-12 15:31:32 +0000
commit58616e67550336ab0555ed21d4f32c329d77bf88 (patch)
tree024af90c901d9f8f879fc399fa72c1d96950c567 /src
parent9e012fc3b7d26bbe446023440ba359a397169e80 (diff)
downloademacs-58616e67550336ab0555ed21d4f32c329d77bf88.tar.gz
emacs-58616e67550336ab0555ed21d4f32c329d77bf88.zip
Give subprocess creation a way to find a valid current directory
for subprocesses when the buffer's default-directory is a handled name. * fileio.c (Funhandled_file_name_directory): New function. (Qunhandled_file_name_directory): New file-name-handler operation. (syms_of_fileio): Defsubr Sunhandled_file_name_directory, and initialize and staticpro Qunhandled_file_name_directory. * callproc.c (Fcall_process): Call Funhandled_file_name_directory on the buffer's default directory. Do it earlier in the function so there's less to GCPRO. * process.c (create_process): Don't check the validity of the buffer's default directory here... (Fstart_process): Instead, do it here; if we call Funhandled_file_name_directory here, there's less GCPROing to do. * callproc.c (Fcall_process_region): Return the value returned by Fcall_process.
Diffstat (limited to 'src')
-rw-r--r--src/callproc.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/src/callproc.c b/src/callproc.c
index 6e47c433144..f5b1b95415d 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -126,7 +126,7 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
126 int nargs; 126 int nargs;
127 register Lisp_Object *args; 127 register Lisp_Object *args;
128{ 128{
129 Lisp_Object display, infile, buffer, path, current_dir; 129 Lisp_Object infile, buffer, current_dir, display, path;
130 int fd[2]; 130 int fd[2];
131 int filefd; 131 int filefd;
132 register int pid; 132 register int pid;
@@ -168,6 +168,33 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
168 else 168 else
169 buffer = Qnil; 169 buffer = Qnil;
170 170
171 /* Make sure that the child will be able to chdir to the current
172 buffer's current directory, or its unhandled equivalent. We
173 can't just have the child check for an error when it does the
174 chdir, since it's in a vfork.
175
176 We have to GCPRO around this because Fexpand_file_name,
177 Funhandled_file_name_directory, and Ffile_accessible_directory_p
178 might call a file name handling function. The argument list is
179 protected by the caller, so all we really have to worry about is
180 buffer. */
181 {
182 struct gcpro gcpro1, gcpro2, gcpro3;
183
184 current_dir = current_buffer->directory;
185
186 GCPRO3 (infile, buffer, current_dir);
187
188 current_dir =
189 expand_and_dir_to_file
190 (Funhandled_file_name_directory (current_dir, Qnil));
191 if (NILP (Ffile_accessible_directory_p (current_dir)))
192 report_file_error ("Setting current directory",
193 Fcons (current_buffer->directory, Qnil));
194
195 UNGCPRO;
196 }
197
171 display = nargs >= 4 ? args[3] : Qnil; 198 display = nargs >= 4 ? args[3] : Qnil;
172 199
173 { 200 {
@@ -207,14 +234,6 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
207#endif 234#endif
208 } 235 }
209 236
210 /* Make sure that the child will be able to chdir to the current
211 buffer's current directory. We can't just have the child check
212 for an error when it does the chdir, since it's in a vfork. */
213 current_dir = expand_and_dir_to_file (current_buffer->directory, Qnil);
214 if (NILP (Ffile_accessible_directory_p (current_dir)))
215 report_file_error ("Setting current directory",
216 Fcons (current_buffer->directory, Qnil));
217
218 { 237 {
219 /* child_setup must clobber environ in systems with true vfork. 238 /* child_setup must clobber environ in systems with true vfork.
220 Protect it from permanent change. */ 239 Protect it from permanent change. */
@@ -359,9 +378,8 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
359 Fdelete_region (start, end); 378 Fdelete_region (start, end);
360 379
361 args[3] = filename_string; 380 args[3] = filename_string;
362 Fcall_process (nargs - 2, args + 2);
363 381
364 return unbind_to (count, Qnil); 382 return unbind_to (count, Fcall_process (nargs - 2, args + 2));
365} 383}
366 384
367#ifndef VMS /* VMS version is in vmsproc.c. */ 385#ifndef VMS /* VMS version is in vmsproc.c. */