All checks were successful
Test / Create distribution (push) Successful in 26s
Test / Sandbox (push) Successful in 1m48s
Test / Fortify (push) Successful in 2m36s
Test / Sandbox (race detector) (push) Successful in 2m52s
Test / Fpkg (push) Successful in 3m32s
Test / Fortify (race detector) (push) Successful in 4m9s
Test / Flake checks (push) Successful in 1m4s
Signed-off-by: Ophestra <cat@gensokyo.uk>
29 lines
556 B
Go
29 lines
556 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
|
|
"git.gensokyo.uk/security/fortify/fst"
|
|
"git.gensokyo.uk/security/fortify/internal/app/setuid"
|
|
"git.gensokyo.uk/security/fortify/internal/fmsg"
|
|
)
|
|
|
|
func mustRunApp(ctx context.Context, config *fst.Config, beforeFail func()) {
|
|
rs := new(fst.RunState)
|
|
a := setuid.MustNew(ctx, std)
|
|
|
|
var code int
|
|
if sa, err := a.Seal(config); err != nil {
|
|
fmsg.PrintBaseError(err, "cannot seal app:")
|
|
code = 1
|
|
} else {
|
|
code = setuid.PrintRunStateErr(rs, sa.Run(rs))
|
|
}
|
|
|
|
if code != 0 {
|
|
beforeFail()
|
|
os.Exit(code)
|
|
}
|
|
}
|