helper/proc: move package out of internal
All checks were successful
Test / Create distribution (push) Successful in 1m32s
Test / Run NixOS test (push) Successful in 4m6s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-02-08 13:03:45 +09:00
parent 7aff3ead3a
commit e14923ae53
14 changed files with 10 additions and 10 deletions

26
helper/proc/self.go Normal file
View File

@@ -0,0 +1,26 @@
package proc
import (
"os"
"sync"
"git.gensokyo.uk/security/fortify/internal/fmsg"
)
var (
executable string
executableOnce sync.Once
)
func copyExecutable() {
if name, err := os.Executable(); err != nil {
fmsg.Fatalf("cannot read executable path: %v", err)
} else {
executable = name
}
}
func MustExecutable() string {
executableOnce.Do(copyExecutable)
return executable
}