use std_options for keep_sigpipe and existence of SIG.PIPE to check for support
This commit is contained in:
@@ -167,6 +167,22 @@ pub const options = struct {
|
||||
options_override.crypto_always_getrandom
|
||||
else
|
||||
false;
|
||||
|
||||
/// By default Zig disables SIGPIPE by setting a "no-op" handler for it. Set this option
|
||||
/// to `true` to prevent that.
|
||||
///
|
||||
/// Note that we use a "no-op" handler instead of SIG_IGN because it will not be inherited by
|
||||
/// any child process.
|
||||
///
|
||||
/// SIGPIPE is triggered when a process attempts to write to a broken pipe. By default, SIGPIPE
|
||||
/// will terminate the process instead of exiting. It doesn't trigger the panic handler so in many
|
||||
/// cases it's unclear why the process was terminated. By capturing SIGPIPE instead, functions that
|
||||
/// write to broken pipes will return the EPIPE error (error.BrokenPipe) and the program can handle
|
||||
/// it like any other error.
|
||||
pub const keep_sigpipe: bool = if (@hasDecl(options_override, "keep_sigpipe"))
|
||||
options_override.keep_sigpipe
|
||||
else
|
||||
false;
|
||||
};
|
||||
|
||||
// This forces the start.zig file to be imported, and the comptime logic inside that
|
||||
|
||||
Reference in New Issue
Block a user