Shutdown hooks docs
This commit is contained in:
parent
110f6d7644
commit
2a1ad4e84f
1 changed files with 11 additions and 0 deletions
11
README.md
11
README.md
|
|
@ -769,6 +769,17 @@ This can be useful for talking to Docker:
|
|||
:RepoTags) ;;=> ["borkdude/babashka:latest"]
|
||||
```
|
||||
|
||||
## Shutdown hook
|
||||
|
||||
Adding a shutdown hook allows you to execute some code before the script exits.
|
||||
|
||||
``` clojure
|
||||
$ bb -e '(-> (Runtime/getRuntime) (.addShutdownHook (Thread. #(println "bye"))))'
|
||||
bye
|
||||
```
|
||||
|
||||
This also works when the script is interrupted with ctrl-c.
|
||||
|
||||
## Bencode
|
||||
|
||||
Babashka comes with the [nrepl/bencode](https://github.com/nrepl/bencode)
|
||||
|
|
|
|||
Loading…
Reference in a new issue