mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +03:00
pty: reset all signals after fork
This commit is contained in:
@ -78,8 +78,10 @@ fn initThread(gpa: Allocator) !void {
|
|||||||
cache_dir.len,
|
cache_dir.len,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Debug logging for Sentry
|
if (comptime builtin.mode == .Debug) {
|
||||||
sentry.c.sentry_options_set_debug(opts, @intFromBool(true));
|
// Debug logging for Sentry
|
||||||
|
sentry.c.sentry_options_set_debug(opts, @intFromBool(true));
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
if (sentry.c.sentry_init(opts) != 0) return error.SentryInitFailed;
|
if (sentry.c.sentry_init(opts) != 0) return error.SentryInitFailed;
|
||||||
|
19
src/pty.zig
19
src/pty.zig
@ -137,6 +137,25 @@ const PosixPty = struct {
|
|||||||
/// This should be called prior to exec in the forked child process
|
/// This should be called prior to exec in the forked child process
|
||||||
/// in order to setup the tty properly.
|
/// in order to setup the tty properly.
|
||||||
pub fn childPreExec(self: Pty) !void {
|
pub fn childPreExec(self: Pty) !void {
|
||||||
|
// Reset our signals
|
||||||
|
var sa: posix.Sigaction = .{
|
||||||
|
.handler = .{ .handler = posix.SIG.DFL },
|
||||||
|
.mask = posix.empty_sigset,
|
||||||
|
.flags = 0,
|
||||||
|
};
|
||||||
|
try posix.sigaction(posix.SIG.ABRT, &sa, null);
|
||||||
|
try posix.sigaction(posix.SIG.ALRM, &sa, null);
|
||||||
|
try posix.sigaction(posix.SIG.BUS, &sa, null);
|
||||||
|
try posix.sigaction(posix.SIG.CHLD, &sa, null);
|
||||||
|
try posix.sigaction(posix.SIG.FPE, &sa, null);
|
||||||
|
try posix.sigaction(posix.SIG.HUP, &sa, null);
|
||||||
|
try posix.sigaction(posix.SIG.ILL, &sa, null);
|
||||||
|
try posix.sigaction(posix.SIG.INT, &sa, null);
|
||||||
|
try posix.sigaction(posix.SIG.SEGV, &sa, null);
|
||||||
|
try posix.sigaction(posix.SIG.TRAP, &sa, null);
|
||||||
|
try posix.sigaction(posix.SIG.TERM, &sa, null);
|
||||||
|
try posix.sigaction(posix.SIG.QUIT, &sa, null);
|
||||||
|
|
||||||
// Create a new process group
|
// Create a new process group
|
||||||
if (setsid() < 0) return error.ProcessGroupFailed;
|
if (setsid() < 0) return error.ProcessGroupFailed;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user