all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* unwind-protect within while-no-input
@ 2024-05-03 12:45 Spencer Baugh
  2024-05-07 18:05 ` Spencer Baugh
  0 siblings, 1 reply; 47+ messages in thread
From: Spencer Baugh @ 2024-05-03 12:45 UTC (permalink / raw)
  To: emacs-devel


I have some process which takes input on stdin; if I don't finish
sending the input on stdin for any reason, the process will sit around
forever waiting.  I'd like to delete the process rather than letting it
linger in that case.

My code (simplified somewhat) looks like:

(defun make-my-proc ()
  (let (proc finished-sending)
    (unwind-protect
        (progn
          (setq proc (make-process :command '("cat")))
          (process-send-string proc "some large string")
          (process-send-eof proc)
          (setq finished-sending t)
          proc)
      (unless finished-sending
        (delete-process proc)))))

However, this seems to be incorrect.  When this is called within a
(while-no-input (make-my-proc)) I sometimes get lingering processes
which haven't received their full input.

Is this because while-no-input can cause a signal to be thrown in the
unwind-forms before the delete-process call?

If so, how can I robustly delete the process?




^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2024-05-29  1:17 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-03 12:45 unwind-protect within while-no-input Spencer Baugh
2024-05-07 18:05 ` Spencer Baugh
2024-05-07 18:49   ` Eli Zaretskii
2024-05-07 19:43     ` Spencer Baugh
2024-05-08  3:59       ` Po Lu
2024-05-08 11:42         ` Michael Heerdegen via Emacs development discussions.
2024-05-08 11:47           ` Michael Heerdegen via Emacs development discussions.
2024-05-08 13:44             ` Spencer Baugh
2024-05-08 16:13               ` Michael Heerdegen via Emacs development discussions.
2024-05-08 17:18                 ` Spencer Baugh
2024-05-08 20:43                   ` Michael Heerdegen via Emacs development discussions.
2024-05-09 12:57                     ` Spencer Baugh
2024-05-09 14:13                       ` Michael Heerdegen via Emacs development discussions.
2024-05-08 12:12           ` Eli Zaretskii
2024-05-08 12:36             ` Michael Heerdegen via Emacs development discussions.
2024-05-08 11:52       ` Eli Zaretskii
2024-05-08 13:57         ` Spencer Baugh
2024-05-08 14:18           ` Eli Zaretskii
2024-05-08 14:38             ` Spencer Baugh
2024-05-08 15:06               ` Eli Zaretskii
2024-05-08 15:14                 ` Spencer Baugh
2024-05-08 18:51                   ` Eli Zaretskii
2024-05-08 19:28                     ` Spencer Baugh
2024-05-09  5:46                       ` Eli Zaretskii
2024-05-09 13:07                         ` Spencer Baugh
2024-05-09 17:41                           ` Dmitry Gutov
2024-05-11  9:48                           ` Eli Zaretskii
2024-05-11 10:37                             ` Eshel Yaron
2024-05-11 10:42                           ` Zhengyi Fu
2024-05-11 21:45                             ` Dmitry Gutov
2024-05-11 22:08                               ` Daniel Mendler via Emacs development discussions.
2024-05-12  1:59                                 ` Dmitry Gutov
2024-05-12  8:50                                   ` Daniel Mendler via Emacs development discussions.
2024-05-12 11:49                                     ` Dmitry Gutov
2024-05-14 21:30                           ` Dmitry Gutov
2024-05-26  2:49                             ` Stefan Monnier via Emacs development discussions.
2024-05-26 15:36                               ` Dmitry Gutov
2024-05-26 18:00                                 ` Stefan Monnier
2024-05-26 22:56                                   ` Dmitry Gutov
2024-05-29  0:39                                     ` Stefan Monnier
2024-05-29  1:17                                       ` Dmitry Gutov
2024-05-08 20:34                     ` Michael Heerdegen via Emacs development discussions.
2024-05-08 16:17               ` Michael Heerdegen via Emacs development discussions.
2024-05-26  2:47   ` Stefan Monnier via Emacs development discussions.
2024-05-26  4:36     ` Stefan Monnier
2024-05-26  4:55     ` Eli Zaretskii
2024-05-26 18:12       ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.