diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-02-26 19:46:43 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-02-26 19:51:44 +0900 |
| commit | 673b648bd35285a1dbfc0348716dd6bdd8064a51 (patch) | |
| tree | 7fa388c20fb7509060964e0380f744bf9178a006 /cmd/fpkg/with.go | |
| parent | 45ad788c6d03bf368010fa8e2a39028bdf0fc078 (diff) | |
cmd/fpkg: call app in-process
Wrapping fortify is slow, painful and error-prone. Start apps in-process instead.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd/fpkg/with.go')
| -rw-r--r-- | cmd/fpkg/with.go | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/cmd/fpkg/with.go b/cmd/fpkg/with.go index b6928bd1..d7b0e968 100644 --- a/cmd/fpkg/with.go +++ b/cmd/fpkg/with.go @@ -1,6 +1,7 @@ package main import ( + "context" "path" "strings" @@ -10,10 +11,11 @@ import ( ) func withNixDaemon( + ctx context.Context, action string, command []string, net bool, updateConfig func(config *fst.Config) *fst.Config, app *bundleInfo, pathSet *appPathSet, dropShell bool, beforeFail func(), ) { - fortifyAppDropShell(updateConfig(&fst.Config{ + mustRunAppDropShell(ctx, updateConfig(&fst.Config{ ID: app.ID, Command: []string{shellPath, "-lc", "rm -f /nix/var/nix/daemon-socket/socket && " + // start nix-daemon @@ -56,8 +58,11 @@ func withNixDaemon( }), dropShell, beforeFail) } -func withCacheDir(action string, command []string, workDir string, app *bundleInfo, pathSet *appPathSet, dropShell bool, beforeFail func()) { - fortifyAppDropShell(&fst.Config{ +func withCacheDir( + ctx context.Context, + action string, command []string, workDir string, + app *bundleInfo, pathSet *appPathSet, dropShell bool, beforeFail func()) { + mustRunAppDropShell(ctx, &fst.Config{ ID: app.ID, Command: []string{shellPath, "-lc", strings.Join(command, " && ")}, Confinement: fst.ConfinementConfig{ @@ -90,12 +95,12 @@ func withCacheDir(action string, command []string, workDir string, app *bundleIn }, dropShell, beforeFail) } -func fortifyAppDropShell(config *fst.Config, dropShell bool, beforeFail func()) { +func mustRunAppDropShell(ctx context.Context, config *fst.Config, dropShell bool, beforeFail func()) { if dropShell { config.Command = []string{shellPath, "-l"} - fortifyApp(config, beforeFail) + mustRunApp(ctx, config, beforeFail) beforeFail() internal.Exit(0) } - fortifyApp(config, beforeFail) + mustRunApp(ctx, config, beforeFail) } |
