From e9a7cd526f4e5f0a8f7b18ad3682d2e3afbcb8ba Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sat, 5 Apr 2025 23:51:39 +0900 Subject: app: improve shim process management This ensures a signal gets delivered to the process instead of relying on parent death behaviour. SIGCONT was chosen as it is the only signal an unprivileged process is allowed to send to processes with different credentials. A custom signal handler is installed because the Go runtime does not expose signal information other than which signal was received, and shim must check pid to ensure reasonable behaviour. Signed-off-by: Ophestra --- main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 237574a2..408f23e1 100644 --- a/main.go +++ b/main.go @@ -289,10 +289,10 @@ func runApp(config *fst.Config) { rs := new(fst.RunState) if sa, err := a.Seal(config); err != nil { fmsg.PrintBaseError(err, "cannot seal app:") - rs.ExitCode = 1 + internal.Exit(1) } else { - // this updates ExitCode - app.PrintRunStateErr(rs, sa.Run(rs)) + internal.Exit(app.PrintRunStateErr(rs, sa.Run(rs))) } - internal.Exit(rs.ExitCode) + + *(*int)(nil) = 0 // not reached } -- cgit v1.3.1