diff --git a/src/apprt/gtk/App.zig b/src/apprt/gtk/App.zig index 6cda51475..7575c547e 100644 --- a/src/apprt/gtk/App.zig +++ b/src/apprt/gtk/App.zig @@ -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; }; diff --git a/src/config/Config.zig b/src/config/Config.zig index 5b7370e37..b6e2d7342 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -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.