static Lisp_Object call_process_cleanup (Lisp_Object arg) { Lisp_Object fdpid = Fcdr (arg); int fd; #if defined (MSDOS) Lisp_Object file; #else pid_t pid; #endif Fset_buffer (Fcar (arg)); CONS_TO_INTEGER (Fcar (fdpid), int, fd); #if defined (MSDOS) /* for MSDOS fdpid is really (fd . tempfile) */ file = Fcdr (fdpid); /* FD is -1 and FILE is "" when we didn't actually create a temporary file in call-process. */ if (fd >= 0) emacs_close (fd); if (!(strcmp (SDATA (file), NULL_DEVICE) == 0 || SREF (file, 0) == '\0')) unlink (SDATA (file)); #else /* not MSDOS */ CONS_TO_INTEGER (Fcdr (fdpid), pid_t, pid); if (call_process_exited) { emacs_close (fd); return Qnil; } if (EMACS_KILLPG (pid, SIGINT) == 0) { ptrdiff_t count = SPECPDL_INDEX (); record_unwind_protect (call_process_kill, fdpid); message1 ("Waiting for process to die...(type C-g again to kill it instantly)"); immediate_quit = 1; QUIT; wait_for_termination (pid); immediate_quit = 0; specpdl_ptr = specpdl + count; /* Discard the unwind protect. */ message1 ("Waiting for process to die...done"); } synch_process_alive = 0; emacs_close (fd); #endif /* not MSDOS */ return Qnil; }
static void call_process_cleanup (Lisp_Object buffer) { Fset_buffer (buffer); if (synch_process_pid) { kill (-synch_process_pid, SIGINT); message1 ("Waiting for process to die...(type C-g again to kill it instantly)"); /* This will quit on C-g. */ bool wait_ok = wait_for_termination (synch_process_pid, NULL, true); synch_process_pid = 0; message1 (wait_ok ? "Waiting for process to die...done" : "Waiting for process to die...internal error"); } }
static Lisp_Object call_process_cleanup (Lisp_Object arg) { Lisp_Object fdpid = Fcdr (arg); #if defined (MSDOS) Lisp_Object file; #else int pid; #endif Fset_buffer (Fcar (arg)); #if defined (MSDOS) /* for MSDOS fdpid is really (fd . tempfile) */ file = Fcdr (fdpid); emacs_close (XFASTINT (Fcar (fdpid))); if (strcmp (SDATA (file), NULL_DEVICE) != 0) unlink (SDATA (file)); #else /* not MSDOS */ pid = XFASTINT (Fcdr (fdpid)); if (call_process_exited) { emacs_close (XFASTINT (Fcar (fdpid))); return Qnil; } if (EMACS_KILLPG (pid, SIGINT) == 0) { int count = SPECPDL_INDEX (); record_unwind_protect (call_process_kill, fdpid); message1 ("Waiting for process to die...(type C-g again to kill it instantly)"); immediate_quit = 1; QUIT; wait_for_termination (pid); immediate_quit = 0; specpdl_ptr = specpdl + count; /* Discard the unwind protect. */ message1 ("Waiting for process to die...done"); } synch_process_alive = 0; emacs_close (XFASTINT (Fcar (fdpid))); #endif /* not MSDOS */ return Qnil; }
static void call_process_cleanup (Lisp_Object buffer) { Fset_buffer (buffer); #ifndef MSDOS if (synch_process_pid) { kill (-synch_process_pid, SIGINT); message1 ("Waiting for process to die...(type C-g again to kill it instantly)"); immediate_quit = 1; QUIT; wait_for_termination (synch_process_pid, 0, 1); synch_process_pid = 0; immediate_quit = 0; message1 ("Waiting for process to die...done"); } #endif /* !MSDOS */ }