apprt/gtk: config to hard fail on cgroup init

This commit is contained in:
Mitchell Hashimoto
2024-06-05 09:47:48 -07:00
parent ad5d44af10
commit 3b41b89c23
2 changed files with 20 additions and 0 deletions

View File

@ -405,6 +405,13 @@ pub fn run(self: *App) !void {
"failed to initialize cgroups, terminals will not be isolated err={}",
.{err},
);
// If we have hard fail enabled then we exit now.
if (self.config.@"linux-cgroup-hard-fail") {
log.err("linux-cgroup-hard-fail enabled, exiting", .{});
return error.CgroupInitFailed;
}
break :cgroup;
};

View File

@ -1012,6 +1012,19 @@ keybind: Keybinds = .{},
///
@"linux-cgroup": LinuxCgroup = .@"single-instance",
/// If this is false, then any cgroup initialization (for linux-cgroup)
/// will be allowed to fail and the failure is ignored. This is useful if
/// you view cgroup isolation as a "nice to have" and not a critical resource
/// management feature, because Ghostty startup will not fail if cgroup APIs
/// fail.
///
/// If this is true, then any cgroup initialization failure will cause
/// Ghostty to exit or new surfaces to not be created.
///
/// Note: this currently only affects cgroup initialization. Subprocesses
/// must always be able to move themselves into an isolated cgroup.
@"linux-cgroup-hard-fail": bool = false,
/// If true, the Ghostty GTK application will run in single-instance mode:
/// each new `ghostty` process launched will result in a new window if there
/// is already a running process.