From ae1a102882103221ef842176dfd8cb1090d5f591 Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Sat, 26 Oct 2024 23:09:32 +0900 Subject: fmsg: support temporarily withholding output Trying to print to a shared stdout is a terrible idea. This change makes it possible to withhold output for the lifetime of the sandbox. Signed-off-by: Ophestra Umiker --- internal/state/print.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'internal/state') diff --git a/internal/state/print.go b/internal/state/print.go index d8f08fac..8ca3529e 100644 --- a/internal/state/print.go +++ b/internal/state/print.go @@ -21,8 +21,7 @@ func MustPrintLauncherStateSimpleGlobal(w **tabwriter.Writer, runDir string) { // read runtime directory to get all UIDs if dirs, err := os.ReadDir(path.Join(runDir, "state")); err != nil && !errors.Is(err, os.ErrNotExist) { - fmsg.Println("cannot read runtime directory:", err) - os.Exit(1) + fmsg.Fatal("cannot read runtime directory:", err) } else { for _, e := range dirs { // skip non-directories @@ -112,13 +111,11 @@ func (s *simpleStore) mustPrintLauncherState(w **tabwriter.Writer, now time.Time }); err != nil { fmsg.Printf("cannot perform action on store %q: %s", path.Join(s.path...), err) if !ok { - fmsg.Println("store faulted before printing") - os.Exit(1) + fmsg.Fatal("store faulted before printing") } } if innerErr != nil { - fmsg.Printf("cannot print launcher state for store %q: %s", path.Join(s.path...), innerErr) - os.Exit(1) + fmsg.Fatalf("cannot print launcher state for store %q: %s", path.Join(s.path...), innerErr) } } -- cgit v1.3.1