aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/fpkg/main.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-02-16 17:26:09 +0900
committerOphestra <cat@gensokyo.uk>2025-02-16 18:51:53 +0900
commite599b5583dd821ed26bdfc01f7f67d4a317b9843 (patch)
treeb444a3dc964814360e6779bc10b30f2e599b537c /cmd/fpkg/main.go
parent33a4ab11c226c736c0d8b2644fbbe27a5ca045e9 (diff)
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 <cat@gensokyo.uk>
Diffstat (limited to 'cmd/fpkg/main.go')
-rw-r--r--cmd/fpkg/main.go14
1 files changed, 8 insertions, 6 deletions
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)
}