( ctx context.Context, manager updateManager, applied aghupdate.AppliedBinary, deps commandDeps, runtime *runtimeContext, attemptRecoveryStart bool, )
| 396 | } |
| 397 | |
| 398 | func rollbackAppliedUpdate( |
| 399 | ctx context.Context, |
| 400 | manager updateManager, |
| 401 | applied aghupdate.AppliedBinary, |
| 402 | deps commandDeps, |
| 403 | runtime *runtimeContext, |
| 404 | attemptRecoveryStart bool, |
| 405 | ) error { |
| 406 | var combined error |
| 407 | if err := manager.Restore(applied); err != nil { |
| 408 | combined = errors.Join(combined, err) |
| 409 | } |
| 410 | if !attemptRecoveryStart || runtime == nil { |
| 411 | return combined |
| 412 | } |
| 413 | if _, running, err := daemonInfo(runtime.HomePaths, deps); err == nil && !running { |
| 414 | if _, startErr := runDaemonDetached(ctx, deps); startErr != nil { |
| 415 | combined = errors.Join(combined, startErr) |
| 416 | } |
| 417 | } |
| 418 | return combined |
| 419 | } |
| 420 | |
| 421 | func combineUpdateErrors(prefix string, primary error, secondary error) string { |
| 422 | parts := []string{strings.TrimSpace(prefix)} |
no test coverage detected