comparison src/callproc.c @ 563:183866b06e0b

[xemacs-hg @ 2001-05-24 07:50:48 by ben] Makefile.in.in, abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, casetab.c, chartab.c, cmdloop.c, cmds.c, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console.c, data.c, database.c, debug.c, device-gtk.c, device-msw.c, device-tty.c, device-x.c, device.c, dialog-gtk.c, dialog-msw.c, dialog-x.c, dialog.c, dired-msw.c, dired.c, doc.c, doprnt.c, dragdrop.c, editfns.c, eldap.c, eldap.h, elhash.c, emacs-widget-accessors.c, emacs.c, emodules.c, esd.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, filelock.c, floatfns.c, fns.c, font-lock.c, frame-gtk.c, frame-x.c, frame.c, general-slots.h, glade.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-gtk.c, gui-x.c, gui.c, gutter.c, hpplay.c, indent.c, input-method-xlib.c, insdel.c, intl.c, keymap.c, libsst.c, libsst.h, linuxplay.c, lisp.h, lread.c, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, miscplay.c, miscplay.h, mule-ccl.c, mule-charset.c, mule-wnnfns.c, mule.c, nas.c, ntplay.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, ralloc.c, rangetab.c, redisplay.c, scrollbar.c, search.c, select-gtk.c, select-x.c, select.c, sgiplay.c, sheap.c, sound.c, specifier.c, sunplay.c, symbols.c, symeval.h, symsinit.h, syntax.c, sysdep.c, toolbar-msw.c, toolbar.c, tooltalk.c, ui-byhand.c, ui-gtk.c, undo.c, unexaix.c, unexapollo.c, unexconvex.c, unexec.c, widget.c, win32.c, window.c: -- defsymbol -> DEFSYMBOL. -- add an error type to all errors. -- eliminate the error functions in eval.c that let you just use Qerror as the type. -- redo the error API to be more consistent, sensibly named, and easier to use. -- redo the error hierarchy somewhat. create new errors: structure-formation-error, gui-error, invalid-constant, stack-overflow, out-of-memory, process-error, network-error, sound-error, printing-unreadable-object, base64-conversion- error; coding-system-error renamed to text-conversion error; some others. -- fix Mule problems in error strings in emodules.c, tooltalk.c. -- fix error handling in mswin open-network-stream. -- Mule-ize all sound files and clean up the headers. -- nativesound.h -> sound.h and used for all sound files. -- move some shared stuff into glyphs-shared.c: first attempt at eliminating some of the massive GTK code duplication. xemacs.mak: add glyphs-shared.c. xemacs-faq.texi: document how to debug X errors subr.el: fix doc string to reflect reality
author ben
date Thu, 24 May 2001 07:51:33 +0000
parents 7039e6323819
children 38db05db9cb5
comparison
equal deleted inserted replaced
562:c775bd016b32 563:183866b06e0b
135 } 135 }
136 synch_process_alive = 0; 136 synch_process_alive = 0;
137 close (fd); 137 close (fd);
138 return Qnil; 138 return Qnil;
139 } 139 }
140
141 static Lisp_Object fork_error;
142 #if 0 /* UNUSED */
143 static void
144 report_fork_error (char *string, Lisp_Object data)
145 {
146 Lisp_Object errstring = lisp_strerror (errno);
147
148 fork_error = Fcons (build_string (string), Fcons (errstring, data));
149
150 /* terminate this branch of the fork, without closing stdin/out/etc. */
151 _exit (1);
152 }
153 #endif /* unused */
154 140
155 DEFUN ("old-call-process-internal", Fold_call_process_internal, 1, MANY, 0, /* 141 DEFUN ("old-call-process-internal", Fold_call_process_internal, 1, MANY, 0, /*
156 Call PROGRAM synchronously in separate process, with coding-system specified. 142 Call PROGRAM synchronously in separate process, with coding-system specified.
157 Arguments are 143 Arguments are
158 (PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS). 144 (PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS).
200 error_file = Qt; 186 error_file = Qt;
201 187
202 #if defined (NO_SUBPROCESSES) 188 #if defined (NO_SUBPROCESSES)
203 /* Without asynchronous processes we cannot have BUFFER == 0. */ 189 /* Without asynchronous processes we cannot have BUFFER == 0. */
204 if (nargs >= 3 && !INTP (args[2])) 190 if (nargs >= 3 && !INTP (args[2]))
205 error ("Operating system cannot handle asynchronous subprocesses"); 191 signal_error (Qunimplemented, "Operating system cannot handle asynchronous subprocesses", Qunbound);
206 #endif /* NO_SUBPROCESSES */ 192 #endif /* NO_SUBPROCESSES */
207 193
208 /* Do all filename munging before building new_argv because GC in 194 /* Do all filename munging before building new_argv because GC in
209 * Lisp code called by various filename-hacking routines might 195 * Lisp code called by various filename-hacking routines might
210 * relocate strings */ 196 * relocate strings */
231 217
232 #if 0 218 #if 0
233 /* This is in FSF, but it breaks everything in the presence of 219 /* This is in FSF, but it breaks everything in the presence of
234 ange-ftp-visited files, so away with it. */ 220 ange-ftp-visited files, so away with it. */
235 if (NILP (Ffile_accessible_directory_p (current_dir))) 221 if (NILP (Ffile_accessible_directory_p (current_dir)))
236 report_file_error ("Setting current directory", 222 signal_error (Qprocess_error, "Setting current directory",
237 Fcons (current_buffer->directory, Qnil)); 223 current_buffer->directory);
238 #endif /* 0 */ 224 #endif /* 0 */
239 NUNGCPRO; 225 NUNGCPRO;
240 } 226 }
241 227
242 GCPRO2 (current_dir, path); 228 GCPRO2 (current_dir, path);
306 } 292 }
307 } 293 }
308 new_argv[max(nargs - 3,1)] = 0; 294 new_argv[max(nargs - 3,1)] = 0;
309 295
310 if (NILP (path)) 296 if (NILP (path))
311 report_file_error ("Searching for program", Fcons (args[0], Qnil)); 297 signal_error (Qprocess_error, "Searching for program", args[0]);
312 new_argv[0] = (char *) XSTRING_DATA (path); 298 new_argv[0] = (char *) XSTRING_DATA (path);
313 299
314 filefd = open ((char *) XSTRING_DATA (infile), O_RDONLY | OPEN_BINARY, 0); 300 filefd = open ((char *) XSTRING_DATA (infile), O_RDONLY | OPEN_BINARY, 0);
315 if (filefd < 0) 301 if (filefd < 0)
316 report_file_error ("Opening process input file", Fcons (infile, Qnil)); 302 report_process_error ("Opening process input file", infile);
317 303
318 if (INTP (buffer)) 304 if (INTP (buffer))
319 { 305 {
320 fd[1] = open (NULL_DEVICE, O_WRONLY | OPEN_BINARY, 0); 306 fd[1] = open (NULL_DEVICE, O_WRONLY | OPEN_BINARY, 0);
321 fd[0] = -1; 307 fd[0] = -1;
366 close (filefd); 352 close (filefd);
367 close (fd[0]); 353 close (fd[0]);
368 if (fd1 >= 0) 354 if (fd1 >= 0)
369 close (fd1); 355 close (fd1);
370 errno = save_errno; 356 errno = save_errno;
371 report_file_error ("Cannot open", Fcons(error_file, Qnil)); 357 report_process_error ("Cannot open", error_file);
372 } 358 }
373 359
374 fork_error = Qnil;
375 #ifdef WIN32_NATIVE 360 #ifdef WIN32_NATIVE
376 pid = child_setup (filefd, fd1, fd_error, new_argv, 361 pid = child_setup (filefd, fd1, fd_error, new_argv,
377 (char *) XSTRING_DATA (current_dir)); 362 (char *) XSTRING_DATA (current_dir));
378 if (!INTP (buffer)) 363 if (!INTP (buffer))
379 { 364 {
422 close (filefd); 407 close (filefd);
423 if (fd1 >= 0) 408 if (fd1 >= 0)
424 close (fd1); 409 close (fd1);
425 } 410 }
426 411
427 if (!NILP (fork_error))
428 signal_error (Qfile_error, fork_error);
429
430 #ifndef WIN32_NATIVE 412 #ifndef WIN32_NATIVE
431 if (pid < 0) 413 if (pid < 0)
432 { 414 {
433 int save_errno = errno; 415 int save_errno = errno;
434 if (fd[0] >= 0) 416 if (fd[0] >= 0)
435 close (fd[0]); 417 close (fd[0]);
436 errno = save_errno; 418 errno = save_errno;
437 report_file_error ("Doing fork", Qnil); 419 report_process_error ("Doing fork", Qunbound);
438 } 420 }
439 #endif 421 #endif
440 422
441 if (INTP (buffer)) 423 if (INTP (buffer))
442 { 424 {
785 /* Spawn the child. (See ntproc.c:Spawnve). */ 767 /* Spawn the child. (See ntproc.c:Spawnve). */
786 cpid = spawnve (_P_NOWAIT, new_argv[0], (const char* const*)new_argv, 768 cpid = spawnve (_P_NOWAIT, new_argv[0], (const char* const*)new_argv,
787 (const char* const*)env); 769 (const char* const*)env);
788 if (cpid == -1) 770 if (cpid == -1)
789 /* An error occurred while trying to spawn the process. */ 771 /* An error occurred while trying to spawn the process. */
790 report_file_error ("Spawning child process", Qnil); 772 report_process_error ("Spawning child process", Qunbound);
791 reset_standard_handles (in, out, err, handles); 773 reset_standard_handles (in, out, err, handles);
792 return cpid; 774 return cpid;
793 #else /* not WIN32_NATIVE */ 775 #else /* not WIN32_NATIVE */
794 /* execvp does not accept an environment arg so the only way 776 /* execvp does not accept an environment arg so the only way
795 to pass this environment is to set environ. Our caller 777 to pass this environment is to set environ. Our caller