Disable signal handlers on AWS lambdas via env var (#462)
* Disable handle-sigint! when BABASHKA_DISABLE_PIPE_SIGNAL_HANDLER is true This allows babashka to be run in an AWS lambda. * Rename BABASHKA_DISABLE_PIPE_SIGNAL_HANDLER to BABASHKA_DISABLE_SIGNAL_HANDLERS Any signal handler used in AWS lambdas will not work. This simplifies/shortens the naming of the env var.
This commit is contained in:
parent
f15d609b45
commit
480d613b62
3 changed files with 10 additions and 9 deletions
|
|
@ -803,8 +803,8 @@ repo](https://github.com/babashka/babashka.pods).
|
|||
## Package babashka script as a AWS Lambda
|
||||
|
||||
AWS Lambda runtime doesn't support signals, therefore babashka has to disable
|
||||
handling of the SIGPIPE. This can be done by setting
|
||||
`BABASHKA_DISABLE_PIPE_SIGNAL_HANDLER` to `true`.
|
||||
handling of SIGINT and SIGPIPE. This can be done by setting
|
||||
`BABASHKA_DISABLE_SIGNAL_HANDLERS` to `true`.
|
||||
|
||||
## Articles, podcasts and videos
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
(identical? :PIPE @pipe-state))
|
||||
|
||||
(defn handle-pipe! []
|
||||
(when-not (= "true" (System/getenv "BABASHKA_DISABLE_PIPE_SIGNAL_HANDLER"))
|
||||
(when-not (= "true" (System/getenv "BABASHKA_DISABLE_SIGNAL_HANDLERS"))
|
||||
(Signal/handle
|
||||
(Signal. "PIPE")
|
||||
(reify SignalHandler
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@
|
|||
(set! *warn-on-reflection* true)
|
||||
|
||||
(defn handle-sigint! []
|
||||
(Signal/handle
|
||||
(Signal. "INT")
|
||||
(reify SignalHandler
|
||||
(handle [_ _]
|
||||
;; This is needed to run shutdown hooks on interrupt, System/exit triggers those
|
||||
(System/exit 0)))))
|
||||
(when-not (= "true" (System/getenv "BABASHKA_DISABLE_SIGNAL_HANDLERS"))
|
||||
(Signal/handle
|
||||
(Signal. "INT")
|
||||
(reify SignalHandler
|
||||
(handle [_ _]
|
||||
;; This is needed to run shutdown hooks on interrupt, System/exit triggers those
|
||||
(System/exit 0))))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue