Ask coding questions

← Back to all posts
restart on error
ragnork (3)

My repl is a discord bot the fetches from an api, and i would prefer not to have to restart it every time someone makes a spelling mistake, so is there a way to have my repl restart on an error

Highwayman (1483)

maybe what you want to do is go into your .replit file and change run="npm start" to
run="while true do npm start done", which will just automatically run your program again every time it shuts down over and over forever...?

LukeC1 (0)

i tried changing run to "while true; do npm start; sleep 2; done" and it seems to be working @Highwayman

Highwayman (1483)

ah yes, semicolons heh I forgot those XP thanks yeah makes sense. @LukeC1

Highwayman (1483)

What exactly do you mean by restart on error? do you mean like if your entire program crashes, you want the repl to automatically restart?

IvanChang111 (14)

I have the same problem, except when I restart is still has an error:(