diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-10-30 03:34:24 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-10-30 03:41:38 +0900 |
| commit | 36f80649059a086d11c3070d41e3838af227e011 (patch) | |
| tree | 7742533e6bbc9bada7690515b0f55001e5cfac4f /internal/outcome/shim.go | |
| parent | eeb9f98e5bd9d4fac6706edb87d06bf757f0fb79 (diff) | |
internal/outcome/process: output via msg
This makes it possible to instrument output behaviour through stub.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/outcome/shim.go')
| -rw-r--r-- | internal/outcome/shim.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/internal/outcome/shim.go b/internal/outcome/shim.go index acc962c1..a2dcb15e 100644 --- a/internal/outcome/shim.go +++ b/internal/outcome/shim.go @@ -3,6 +3,7 @@ package outcome import ( "context" "errors" + "fmt" "io" "log" "os" @@ -213,11 +214,19 @@ func shimEntrypoint(k syscallDispatcher) { z.WaitDelay = state.Shim.WaitDelay if err := k.containerStart(z); err != nil { - printMessageError("cannot start container:", err) + var f func(v ...any) + if logger := msg.GetLogger(); logger != nil { + f = logger.Println + } else { + f = func(v ...any) { + msg.Verbose(fmt.Sprintln(v...)) + } + } + printMessageError(f, "cannot start container:", err) k.exit(hst.ExitFailure) } if err := k.containerServe(z); err != nil { - printMessageError("cannot configure container:", err) + printMessageError(func(v ...any) { k.fatal(fmt.Sprintln(v...)) }, "cannot configure container:", err) } if err := k.seccompLoad( |
