()
| 114 | } |
| 115 | |
| 116 | async function start(): Promise<LifecycleResult> { |
| 117 | if (!existsSync(deps.unitPath())) { |
| 118 | return { |
| 119 | ok: false, |
| 120 | message: 'systemd unit is not installed. Run `kimi server install` first.', |
| 121 | }; |
| 122 | } |
| 123 | const result = await deps.execSystemctl(['start', KIMI_SERVER_SYSTEMD_UNIT]); |
| 124 | if (result.code !== 0) { |
| 125 | return { |
| 126 | ok: false, |
| 127 | message: `systemctl --user start failed: ${detail(result) ?? 'unknown error'}`, |
| 128 | }; |
| 129 | } |
| 130 | return { ok: true, message: `Kimi server started (${KIMI_SERVER_SYSTEMD_UNIT}).` }; |
| 131 | } |
| 132 | |
| 133 | async function stop(): Promise<LifecycleResult> { |
| 134 | const result = await deps.execSystemctl(['stop', KIMI_SERVER_SYSTEMD_UNIT]); |
nothing calls this directly
no test coverage detected