Restart Deno process on crash
Hello,
The following Node snippet allows a script to restart on crash :
What's its Deno equivalent ?
Thanks
3 Replies
For Deno, try pup! (And for node, you should really use something like PM2 instead of that hack <:fast_deno:1035517481189642271> )
Short way of keeping a process alive
pup run -AC "deno run script.ts"
If you do not want to install pup
deno run -A https://deno.land/x/pup@1.0.0-beta.5/pup.ts run -AC "deno run script.ts"
Explanation: -A
is --autostart
and -C
is --cmd
Full manual at https://hexagon.github.io/pup/
IF you really dont want to use a separate command, but rather relaunch your application internally, you can use Pup programmatically.
... and run this script with --allow-run
Docs for this at https://hexagon.github.io/pup/library.htmlThanks but I want the script to be able to restart itself, not depend on another script to do so.
You could just wrap
around your main function