How to make REPLs without reload reloadable using SIGINT

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the workflows category.

Last Updated: 2022-12-01

I wanted to be able to reload my PHP Laravel REPL. But it did not have such a feature built in.

So instead I ran this command:

while true; do php artisan tinker; done

With this loop running, I could:

What is Ctrl-D?

Ctrl-D is not a signal. It means EOF and it flushes the input typed so far - but without pressing enter. Basically it tells the current artisan REPL that I won't be typing any more commands, so it exits.