Auto-relaunch on crash


Is it possible to automatically relaunch an electron app if there is a crash?


It depends on what you mean by “crash”. If you mean an unhandled exception, you could add an unhandled exception handler that then calls app.relaunch. If you mean a full crash, you could instead of launching your app from an icon or script … you could launch a process that starts your app and watches to see if it crashes. If it crashes, your monitor process could launch a new instance of your app. Most operating systems also have a built-in system for doing things like this.