diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-06-28 18:01:51 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-06-28 18:01:51 +0900 |
| commit | cf7c34555c8df07d9baf582c65a9e88d1605e075 (patch) | |
| tree | 34d83229ad61bc5f3f1316f516aba67349449677 /cmd | |
| parent | d96eecded0964d3bb5ff5db369740fe9663c1d8b (diff) | |
cmd/earlyinit: improve error messages
This improves readability, especially on a small display.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/earlyinit/main.go | 4 | ||||
| -rw-r--r-- | cmd/earlyinit/modprobe.go | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/cmd/earlyinit/main.go b/cmd/earlyinit/main.go index d1652e5f..987faeab 100644 --- a/cmd/earlyinit/main.go +++ b/cmd/earlyinit/main.go @@ -7,6 +7,7 @@ package main import ( "context" "crypto/rand" + "io" "log" "os" "os/signal" @@ -51,13 +52,14 @@ func init() { func fatal(v ...any) { log.Println(v...) log.Println("unable to continue, please reboot and resolve the problem manually") + log.SetOutput(io.Discard) select {} } // must calls fatal with err if it is non-nil. func must(err error) { if err != nil { - log.Println(err) + fatal(err) select {} } } diff --git a/cmd/earlyinit/modprobe.go b/cmd/earlyinit/modprobe.go index 8addf973..8194c150 100644 --- a/cmd/earlyinit/modprobe.go +++ b/cmd/earlyinit/modprobe.go @@ -26,8 +26,9 @@ var _ report.RepresentableError = ModprobeError{} func (ModprobeError) Representable() {} func (e ModprobeError) Error() string { return fmt.Sprintf( - "modprobe exit status %d: %s", - e.ExitCode, strings.TrimSpace(e.Stderr), + "%s (exit status %d)", + strings.TrimPrefix(strings.TrimSpace(e.Stderr), "modprobe: "), + e.ExitCode, ) } |
