mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
21 lines
568 B
Zig
21 lines
568 B
Zig
const std = @import("std");
|
|
const build_options = @import("build_options");
|
|
|
|
pub usingnamespace if (build_options.keep_sigpipe) struct {
|
|
pub const std_options = .{
|
|
.keep_sigpipe = true,
|
|
};
|
|
} else struct {};
|
|
|
|
pub fn main() !void {
|
|
const pipe = try std.os.pipe();
|
|
std.os.close(pipe[0]);
|
|
_ = std.os.write(pipe[1], "a") catch |err| switch (err) {
|
|
error.BrokenPipe => {
|
|
try std.io.getStdOut().writer().writeAll("BrokenPipe\n");
|
|
std.os.exit(123);
|
|
},
|
|
else => |e| return e,
|
|
};
|
|
unreachable;
|
|
}
|