()
| 113 | } |
| 114 | |
| 115 | async function uninstall(): Promise<LifecycleResult> { |
| 116 | if (!(await deps.taskExists())) { |
| 117 | deleteInstallPlan(); |
| 118 | return { ok: true, message: 'Scheduled task was not installed; nothing to remove.' }; |
| 119 | } |
| 120 | |
| 121 | await deps.execSchtasks(['/End', '/TN', KIMI_SERVER_TASK_NAME]).catch(() => undefined); |
| 122 | const del = await deps.execSchtasks(['/Delete', '/TN', KIMI_SERVER_TASK_NAME, '/F']); |
| 123 | if (del.code !== 0) { |
| 124 | return { |
| 125 | ok: false, |
| 126 | message: `schtasks /Delete failed: ${detail(del) ?? 'unknown error'}`, |
| 127 | }; |
| 128 | } |
| 129 | deleteInstallPlan(); |
| 130 | return { ok: true, message: `Scheduled task removed (${KIMI_SERVER_TASK_NAME}).` }; |
| 131 | } |
| 132 | |
| 133 | async function start(): Promise<LifecycleResult> { |
| 134 | if (!(await deps.taskExists())) { |
nothing calls this directly
no test coverage detected