MCPcopy Create free account
hub / github.com/cocoindex-io/cocoindex-code / daemon_stop

Function daemon_stop

src/cocoindex_code/cli.py:1056–1080  ·  view source on GitHub ↗

Stop the daemon.

()

Source from the content-addressed store, hash-verified

1054
1055@daemon_app.command("stop")
1056def daemon_stop() -> None:
1057 """Stop the daemon."""
1058 from ._daemon_paths import daemon_pid_path
1059 from .client import is_daemon_running, stop_daemon
1060
1061 pid_path = daemon_pid_path()
1062 if not pid_path.exists() and not is_daemon_running():
1063 _typer.echo("Daemon is not running.")
1064 return
1065
1066 stop_daemon()
1067
1068 # Wait for process to exit (check both pid file and socket)
1069 import time
1070
1071 deadline = time.monotonic() + 5.0
1072 while time.monotonic() < deadline:
1073 if not pid_path.exists() and not is_daemon_running():
1074 break
1075 time.sleep(0.1)
1076
1077 if pid_path.exists() or is_daemon_running():
1078 _typer.echo("Warning: daemon may not have stopped cleanly.", err=True)
1079 else:
1080 _typer.echo("Daemon stopped.")
1081
1082
1083@app.command("run-daemon", hidden=True)

Callers

nothing calls this directly

Calls 3

daemon_pid_pathFunction · 0.85
is_daemon_runningFunction · 0.85
stop_daemonFunction · 0.85

Tested by

no test coverage detected