Closed jscheid closed 3 years ago
Sounds good!
However, I think that a new prettier process invoked by prettier-restart
exits immediately.
prettier-process (local) quit unexpectedly: hangup
It seems that a new process was killed by kill-buffer
in sentinels of processes that received SIGQUIT
signal. I propose to remove current process sentinels before calling quit-process
like this below.
(defun prettier--quit-all-processes (&optional restart)
"Quit all Prettier sub-processes."
(maphash (lambda (_key process)
(when restart (set-process-sentinel process nil))
(quit-process process))
prettier-processes)
(clrhash prettier-processes)
(setq prettier-nvm-node-command-cache nil))
(defun prettier-restart ()
(interactive)
(prettier--quit-all-processes t)
;; ...
)
But I also think the change seems to be a little messy, so I was wondering about changing the sentinel code. What do you think?
Hi @asbish, thanks for testing! I can't seem to reproduce this in a simple case:
M-x global-prettier-mode RET
M-x find-file RET /some/file.js RET
M-x list-processes RET
-- shows one process runningM-x prettier-restart RET
M-x list-processes RET
-- again shows one process runningI've also tried a few other things (ensure prettier-prettify
runs before/after restarting) but no luck.
Which Emacs version are you using and do you have a way to reproduce this reliably?
Thank you for your response.
I've tried your procedure on freshly installed Fedora 33 (not VM) and Emacs 27.1 (rpm). Even in this case, I got the same message, prettier-process (local) quit unexpectedly: hangup
and besides list-processes
shows nothing after running prettier-restart
.
init.el
and prettier-info.el
(before prettier-restart
) are here.
Thanks @asbish , it was working fine on MacOS but I can reproduce on Linux. Good catch! Can you try again now?
(CI is red but that will hopefuly be fixed soon by rejeep/nvm.el#20)
Thanks for re-testing.
This is intended to ensure that the version of the JavaScript code running in the child process matches that of the Elisp code.
Also, introduce a new interactive function called prettier-restart that can be used to explicitly restart the system so that configuration changes get picked up.