Function: majutsu--process-wait
majutsu--process-wait is a natively compiled function defined in
majutsu-process.el.
Signature
(majutsu--process-wait PROCESS &optional STDERR-PROCESS)
Documentation
Wait for PROCESS to finish while continuing to service Emacs subprocesses.
This is used for commands that are synchronous from Majutsu's point of view, but may need another Emacs subprocess to run concurrently. In particular, GnuPG setups using an Emacs-based pinentry need Emacs to keep servicing the server/pinentry process while jj is waiting for GPG.
accept-process-output keeps servicing every Emacs subprocess while it
waits, so pinentry stays responsive even though we block on PROCESS. When
STDERR-PROCESS is non-nil, also drain it; per the Emacs manual, output from
a separate standard error process is not delivered by waiting on the main
process alone.
Process sentinels run with quitting inhibited, but this helper can be
re-entered from a sentinel-triggered refresh. Locally re-enable quitting
around the blocking wait so Emacs does not warn about an uninterruptible
accept-process-output call.
If the user interrupts the wait with C-g, return 255 so callers can
finalize the process section as a failed command. In that case the
surrounding unwind-protect is responsible for cleaning up PROCESS and
STDERR-PROCESS; any partially captured stderr is discarded.
Source Code
;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-process.el
(defun majutsu--process-wait (process &optional stderr-process)
"Wait for PROCESS to finish while continuing to service Emacs subprocesses.
This is used for commands that are synchronous from Majutsu's point of
view, but may need another Emacs subprocess to run concurrently. In
particular, GnuPG setups using an Emacs-based pinentry need Emacs to keep
servicing the server/pinentry process while jj is waiting for GPG.
`accept-process-output' keeps servicing every Emacs subprocess while it
waits, so pinentry stays responsive even though we block on PROCESS. When
STDERR-PROCESS is non-nil, also drain it; per the Emacs manual, output from
a separate standard error process is not delivered by waiting on the main
process alone.
Process sentinels run with quitting inhibited, but this helper can be
re-entered from a sentinel-triggered refresh. Locally re-enable quitting
around the blocking wait so Emacs does not warn about an uninterruptible
`accept-process-output' call.
If the user interrupts the wait with `C-g', return 255 so callers can
finalize the process section as a failed command. In that case the
surrounding `unwind-protect' is responsible for cleaning up PROCESS and
STDERR-PROCESS; any partially captured stderr is discarded."
(condition-case nil
(if (with-local-quit
(while (accept-process-output process))
(when stderr-process
(while (accept-process-output stderr-process)))
t)
(process-exit-status process)
(setq quit-flag nil)
255)
(quit 255)))