From e599b5583dd821ed26bdfc01f7f67d4a317b9843 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sun, 16 Feb 2025 17:26:09 +0900 Subject: fmsg: implement suspend in writer This removes the requirement to call fmsg.Exit on every exit path, and enables direct use of the "log" package. However, fmsg.BeforeExit is still encouraged when possible to catch exit on suspended output. Signed-off-by: Ophestra --- cmd/fpkg/main.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'cmd/fpkg/main.go') diff --git a/cmd/fpkg/main.go b/cmd/fpkg/main.go index f348cb5e..e95a36cb 100644 --- a/cmd/fpkg/main.go +++ b/cmd/fpkg/main.go @@ -2,8 +2,10 @@ package main import ( "flag" + "log" "os" + "git.gensokyo.uk/security/fortify/internal" "git.gensokyo.uk/security/fortify/internal/fmsg" ) @@ -11,7 +13,7 @@ const shell = "/run/current-system/sw/bin/bash" func init() { if err := os.Setenv("SHELL", shell); err != nil { - fmsg.Fatalf("cannot set $SHELL: %v", err) + log.Fatalf("cannot set $SHELL: %v", err) } } @@ -24,14 +26,14 @@ func init() { } func main() { - fmsg.SetPrefix("fpkg") + fmsg.Prepare("fpkg") flag.Parse() - fmsg.SetVerbose(flagVerbose) + fmsg.Store(flagVerbose) args := flag.Args() if len(args) < 1 { - fmsg.Fatal("invalid argument") + log.Fatal("invalid argument") } switch args[0] { @@ -41,8 +43,8 @@ func main() { actionStart(args[1:]) default: - fmsg.Fatal("invalid argument") + log.Fatal("invalid argument") } - fmsg.Exit(0) + internal.Exit(0) } -- cgit v1.3.1