Mercurial > emacs
comparison src/callproc.c @ 6275:132464faeaf4
Don't kill remaining processes if child exits.
(call_process_exited): New variable.
(Fcall_process): Set it.
(call_process_cleanup): Test it.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 09 Mar 1994 22:10:08 +0000 |
parents | ae4c6623837b |
children | d4fe8a853557 |
comparison
equal
deleted
inserted
replaced
6274:ec7e22ebd6b3 | 6275:132464faeaf4 |
---|---|
93 this is exit code of synchronous subprocess. */ | 93 this is exit code of synchronous subprocess. */ |
94 int synch_process_retcode; | 94 int synch_process_retcode; |
95 | 95 |
96 extern Lisp_Object Vdoc_file_name; | 96 extern Lisp_Object Vdoc_file_name; |
97 | 97 |
98 /* Clean up when exiting Fcall_process. | |
99 On MSDOS, delete the temporary file on any kind of termination. | |
100 On Unix, kill the process and any children on termination by signal. */ | |
101 | |
102 /* Nonzero if this is termination due to exit. */ | |
103 static int call_process_exited; | |
104 | |
98 #ifndef VMS /* VMS version is in vmsproc.c. */ | 105 #ifndef VMS /* VMS version is in vmsproc.c. */ |
99 | 106 |
100 static Lisp_Object | 107 static Lisp_Object |
101 call_process_kill (fdpid) | 108 call_process_kill (fdpid) |
102 Lisp_Object fdpid; | 109 Lisp_Object fdpid; |
117 close (XFASTINT (Fcar (fdpid))); | 124 close (XFASTINT (Fcar (fdpid))); |
118 if (strcmp (XSTRING (file)-> data, NULL_DEVICE) != 0) | 125 if (strcmp (XSTRING (file)-> data, NULL_DEVICE) != 0) |
119 unlink (XSTRING (file)->data); | 126 unlink (XSTRING (file)->data); |
120 #else /* not MSDOS */ | 127 #else /* not MSDOS */ |
121 register int pid = XFASTINT (Fcdr (fdpid)); | 128 register int pid = XFASTINT (Fcdr (fdpid)); |
129 | |
130 if (call_process_exited) | |
131 return Qnil; | |
122 | 132 |
123 if (EMACS_KILLPG (pid, SIGINT) == 0) | 133 if (EMACS_KILLPG (pid, SIGINT) == 0) |
124 { | 134 { |
125 int count = specpdl_ptr - specpdl; | 135 int count = specpdl_ptr - specpdl; |
126 record_unwind_protect (call_process_kill, fdpid); | 136 record_unwind_protect (call_process_kill, fdpid); |
370 the facilities for handling SIGCHLD. */ | 380 the facilities for handling SIGCHLD. */ |
371 wait_without_blocking (); | 381 wait_without_blocking (); |
372 #endif /* subprocesses */ | 382 #endif /* subprocesses */ |
373 return Qnil; | 383 return Qnil; |
374 } | 384 } |
385 | |
386 call_process_exited = 0; | |
375 | 387 |
376 #ifdef MSDOS | 388 #ifdef MSDOS |
377 /* MSDOS needs different cleanup information. */ | 389 /* MSDOS needs different cleanup information. */ |
378 record_unwind_protect (call_process_cleanup, | 390 record_unwind_protect (call_process_cleanup, |
379 Fcons (make_number (fd[0]), build_string (tempfile))); | 391 Fcons (make_number (fd[0]), build_string (tempfile))); |
414 wait_for_termination (pid); | 426 wait_for_termination (pid); |
415 | 427 |
416 immediate_quit = 0; | 428 immediate_quit = 0; |
417 | 429 |
418 set_buffer_internal (old); | 430 set_buffer_internal (old); |
431 | |
432 /* Don't kill any children that the subprocess may have left behind | |
433 when exiting. */ | |
434 call_process_exited = 1; | |
419 | 435 |
420 unbind_to (count, Qnil); | 436 unbind_to (count, Qnil); |
421 | 437 |
422 if (synch_process_death) | 438 if (synch_process_death) |
423 return build_string (synch_process_death); | 439 return build_string (synch_process_death); |