fix: address Plan 2 final-review findings

- tui/doc.go: remove teatest blank import (test harness in prod binary)
- cmd: honor wizard HaltOnError toggle in addition to --halt-on-error flag
- cmd: wire SIGINT/SIGTERM to root context via signal.NotifyContext
- dashboard/run: derive engine context and cancel on tea.Program exit
  so the engine goroutine does not outlive Run
This commit is contained in:
MDietermann
2026-04-13 22:26:54 +02:00
parent ea5667e040
commit 2ebaa6b5c6
3 changed files with 20 additions and 10 deletions

View File

@@ -4,6 +4,8 @@ import (
"context"
"fmt"
"os"
"os/signal"
"syscall"
"time"
"github.com/spf13/cobra"
@@ -41,7 +43,13 @@ func main() {
Version: version,
}
root.AddCommand(newInstallCmd())
if err := root.Execute(); err != nil {
// Wire SIGINT/SIGTERM to a cancellable context so long-running phases
// (engine.Run, sudo keepalive) observe the cancellation promptly.
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
if err := root.ExecuteContext(ctx); err != nil {
fmt.Fprintln(os.Stderr, "error:", err)
os.Exit(1)
}
@@ -140,7 +148,8 @@ func newInstallCmd() *cobra.Command {
fmt.Fprintln(os.Stdout, "installation cancelled")
return nil
}
sum, runErr = dashboard.Run(ctx, Registry, finalState, halt)
// Either the CLI flag or the wizard toggle can force halt-on-error.
sum, runErr = dashboard.Run(ctx, Registry, finalState, halt || finalState.HaltOnError)
}
ended := time.Now().UTC()