Closed yveszoundi closed 10 years ago
I'm currently using an advice to auto-close services buffer
(defadvice prodigy-stop-service
(after prodigy-stop-service-close-buffer (service) activate )
"Close prodigy service buffer after the stop call."
(let* ((service-name-downcased (downcase (plist-get service :name)))
(service-buffer-name (concat "*prodigy-" service-name-downcased "*")))
(when (get-buffer service-buffer-name)
(kill-buffer (get-buffer service-buffer-name)))))
I think a global variable (for example prodigy-kill-process-buffer-on-stop
) is a good idea. But I also think it makes sense that this can be specified per service, hence override the global setting.
For example:
(prodigy-define-service
:name "foo"
:kill-process-buffer-on-stop t
)
I've been thinking of hooks as well, but that's not just related to stop. That would make sense for start and restart also for example.
(prodigy-define-service
:name "foo"
:after-stop (lambda ()
(kill-buffer ...)
))
Another configuration that might be useful is prodigy-erase-process-buffer-on-start
, so that if the process have been started before, the contents is cleared.
What do you think?
That sounds perfectly reasonable to me, especially in the early stages of the project.
Issue #3 is kind of related. When providing services definitions, users should be able to provide a way to ensure that the desired action has completed with the expected side-effect, if needed (Tomcat started but not ready yet, WebRick stop initiated but not completed, etc.).
If the signal sent to terminate a program is a SIGKILL, there's no need for extra logic. In most cases, I think that a SIGTERM will be used to allow programs to shutdown gracefully without creating any kind of state/db corruption. Therefore the action should complete successfully prior to calling any hook.
Closing this issue in favor of https://github.com/rejeep/prodigy.el/issues/24 and https://github.com/rejeep/prodigy.el/issues/25.
I think that it would be useful to have the following features:
auto-close-service-buffer-on-stop
to close theprodigy-service-name
buffer if theservice-name
is stopped.stop-service-hook
in the same spirit of init-async? If bound, then call the hook after sending the signal?Below is an example of what I use with Tomcat. When I stop the service, ideally I want to close the "prodigy-tomcat" buffer automatically. Thus a
auto-close-service-buffer-on-stop
parameter that defaults tot
would be convenient.Thanks