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>
19 lines
320 B
Go
19 lines
320 B
Go
package init0
|
|
|
|
import (
|
|
"os"
|
|
"path"
|
|
|
|
"git.gensokyo.uk/security/fortify/internal"
|
|
)
|
|
|
|
// used by the parent process
|
|
|
|
// TryArgv0 calls [Main] if argv0 indicates the process is started from a file named "init".
|
|
func TryArgv0() {
|
|
if len(os.Args) > 0 && path.Base(os.Args[0]) == "init" {
|
|
Main()
|
|
internal.Exit(0)
|
|
}
|
|
}
|