Support AWS Lambda custom runtime (#305)

* environment variable to disable handling of SIGPIPE

* rename env variable to BABASHKA_DISABLE_PIPE_HANDLER
This commit is contained in:
Dainius Jocas 2020-03-21 21:17:57 +02:00 committed by GitHub
parent ce028644fc
commit b14d239ebb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -1104,6 +1104,10 @@ $ docker run --rm script 1 2 3
Your command line args: (1 2 3)
```
## 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_HANDLER` to `true`.
## Thanks
- [adgoji](https://www.adgoji.com/) for financial support

View file

@ -289,7 +289,8 @@ Everything after that is bound to *command-line-args*."))
(defn main
[& args]
(handle-pipe!)
(when-not (Boolean/valueOf ^String (System/getenv "BABASHKA_DISABLE_PIPE_HANDLER"))
(handle-pipe!))
#_(binding [*out* *err*]
(prn "M" (meta (get bindings 'future))))
(binding [*unrestricted* true]