Commit d89e06c
fix(update): report failure when systemctl will not start the update timer (#282)
`moshcode update --timer --install` writes the systemd units, runs
`systemctl daemon-reload` and `systemctl enable --now`, then always
prints "checking on a schedule now" and exits 0 — even when the enable
fails. On a host without systemd (a container, WSL, macOS) or without
root, the timer never starts, so the tool promises an auto-update that
will never fire.
Two layers were dropping the failure:
- bin/moshcode.mjs wired `runner` to swallow execFile's error and always
resolve { ok: true }, so selfUpdateCommand could never see a failure.
- selfUpdateCommand ignored the runner results entirely.
Surface execFile's error as { ok: !err }, and when daemon-reload or
enable reports ok:false, tell the user the timer is not scheduled yet
and exit 1 instead of claiming success. The existing tests already
inject runner: () => ({ ok: true }), so the { ok } contract is honored.
Co-authored-by: clawedassistant26 <307253840+clawedassistant26@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 7e4e07f commit d89e06c
3 files changed
Lines changed: 33 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
420 | | - | |
| 420 | + | |
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
193 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
194 | 202 | | |
195 | 203 | | |
196 | 204 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
151 | 173 | | |
152 | 174 | | |
153 | 175 | | |
| |||
0 commit comments