diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-02-16 17:26:09 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-02-16 18:51:53 +0900 |
| commit | e599b5583dd821ed26bdfc01f7f67d4a317b9843 (patch) | |
| tree | b444a3dc964814360e6779bc10b30f2e599b537c /cmd/fpkg/paths.go | |
| parent | 33a4ab11c226c736c0d8b2644fbbe27a5ca045e9 (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/paths.go')
| -rw-r--r-- | cmd/fpkg/paths.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd/fpkg/paths.go b/cmd/fpkg/paths.go index cf36c096..231388e5 100644 --- a/cmd/fpkg/paths.go +++ b/cmd/fpkg/paths.go @@ -1,6 +1,7 @@ package main import ( + "log" "os" "os/exec" "path" @@ -25,8 +26,8 @@ func init() { func lookPath(file string) string { if p, err := exec.LookPath(file); err != nil { - fmsg.Fatalf("%s: command not found", file) - panic("unreachable") + log.Fatalf("%s: command not found", file) + return "" } else { return p } @@ -35,15 +36,14 @@ func lookPath(file string) string { var beforeRunFail = new(atomic.Pointer[func()]) func mustRun(name string, arg ...string) { - fmsg.VPrintf("spawning process: %q %q", name, arg) + fmsg.Verbosef("spawning process: %q %q", name, arg) cmd := exec.Command(name, arg...) cmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr if err := cmd.Run(); err != nil { if f := beforeRunFail.Swap(nil); f != nil { (*f)() } - fmsg.Fatalf("%s: %v", name, err) - panic("unreachable") + log.Fatalf("%s: %v", name, err) } } |
