run_with_reloader
Runs a function with an auto-reloader that monitors file changes and restarts the process as needed. It handles termination signals, manages the execution environment via environment variables, and catches keyboard interrupts to exit gracefully.
def run_with_reloader(
main_func: callable,
*args: any,
**kwargs: any
) - > null
Runs the provided main function while monitoring the filesystem for changes, automatically restarting the process when a file modification is detected.
Parameters
| Name | Type | Description |
|---|---|---|
| main_func | callable | The entry point function to be executed and monitored by the reloader. |
| *args | any | Variable positional arguments to be passed to the main_func. |
| **kwargs | any | Variable keyword arguments to be passed to the main_func. |
Returns
| Type | Description |
|---|---|
null | This function does not return a value; it manages the process lifecycle and exits the system upon completion or interruption. |