()
| 95 | } |
| 96 | |
| 97 | async function uninstall(): Promise<LifecycleResult> { |
| 98 | const unitPath = deps.unitPath(); |
| 99 | if (!existsSync(unitPath)) { |
| 100 | deleteInstallPlan(); |
| 101 | return { ok: true, message: 'systemd unit was not installed; nothing to remove.' }; |
| 102 | } |
| 103 | await deps.execSystemctl(['disable', '--now', KIMI_SERVER_SYSTEMD_UNIT]).catch(() => undefined); |
| 104 | try { |
| 105 | rmSync(unitPath, { force: true }); |
| 106 | } catch (error) { |
| 107 | throw new Error( |
| 108 | `failed to remove unit ${unitPath}: ${error instanceof Error ? error.message : String(error)}`, |
| 109 | ); |
| 110 | } |
| 111 | await deps.execSystemctl(['daemon-reload']).catch(() => undefined); |
| 112 | deleteInstallPlan(); |
| 113 | return { ok: true, message: `systemd unit removed (${unitPath}).` }; |
| 114 | } |
| 115 | |
| 116 | async function start(): Promise<LifecycleResult> { |
| 117 | if (!existsSync(deps.unitPath())) { |
nothing calls this directly
no test coverage detected