MCPcopy Create free account
hub / github.com/compozy/agh / newDaemonStopCommand

Function newDaemonStopCommand

internal/cli/daemon.go:106–137  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

104}
105
106func newDaemonStopCommand(deps commandDeps) *cobra.Command {
107 return &cobra.Command{
108 Use: "stop",
109 Short: "Stop the AGH daemon",
110 Example: ` # Ask the running daemon to stop
111 agh daemon stop`,
112 RunE: func(cmd *cobra.Command, _ []string) error {
113 runtime, err := loadRuntimeContext(deps)
114 if err != nil {
115 return err
116 }
117
118 info, running, err := daemonInfo(runtime.HomePaths, deps)
119 if err != nil {
120 return err
121 }
122 if !running {
123 return errors.New("cli: daemon is not running")
124 }
125
126 if err := deps.signalProcess(info.PID, syscall.SIGTERM); err != nil {
127 return err
128 }
129
130 status, err := waitForDaemonStop(cmd.Context(), deps, runtime, info)
131 if err != nil {
132 return err
133 }
134 return writeCommandOutput(cmd, daemonStatusBundle(status, deps.now))
135 },
136 }
137}
138
139func runDaemonForeground(ctx context.Context, deps commandDeps) error {
140 runtime, err := loadRuntimeContext(deps)

Callers 1

newDaemonCommandFunction · 0.85

Calls 6

loadRuntimeContextFunction · 0.85
daemonInfoFunction · 0.85
waitForDaemonStopFunction · 0.85
writeCommandOutputFunction · 0.85
daemonStatusBundleFunction · 0.85
signalProcessMethod · 0.80

Tested by

no test coverage detected