Start the daemon process.
(args: argparse.Namespace)
| 29 | |
| 30 | |
| 31 | def _handle_start(args: argparse.Namespace) -> None: |
| 32 | """Start the daemon process.""" |
| 33 | from .daemon import WatchDaemon, is_daemon_running, load_config |
| 34 | |
| 35 | if is_daemon_running(): |
| 36 | print("Error: Daemon is already running.") |
| 37 | sys.exit(1) |
| 38 | |
| 39 | config = load_config() |
| 40 | daemon = WatchDaemon(config=config) |
| 41 | daemon.start() |
| 42 | |
| 43 | if not args.foreground: |
| 44 | daemon.daemonize() |
| 45 | |
| 46 | daemon.run_forever() |
| 47 | |
| 48 | |
| 49 | def _handle_stop(_args: argparse.Namespace) -> None: |