authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-19 17:38:15-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-20 01:06:28-07:00
log9d00f69be58e7b807e26ba8a38050dd486d487f4
treecd3f0601527f3884df3f21dbe8b18c4bbea73a76
parent4f742c4cfc3c3134a0d6ebfdfc354286ae97b2c1

move std.zig.fatal to std.process.fatal


2 files changed, 8 insertions(+), 4 deletions(-)

lib/std/process.zig+6
...@@ -2032,3 +2032,9 @@ pub fn createWindowsEnvBlock(allocator: mem.Allocator, env_map: *const EnvMap) !...@@ -2032,3 +2032,9 @@ pub fn createWindowsEnvBlock(allocator: mem.Allocator, env_map: *const EnvMap) !
2032 i += 1;2032 i += 1;
2033 return try allocator.realloc(result, i);2033 return try allocator.realloc(result, i);
2034}2034}
2035
2036/// Logs an error and then terminates the process with exit code 1.
2037pub fn fatal(comptime format: []const u8, format_arguments: anytype) noreturn {
2038 std.log.err(format, format_arguments);
2039 exit(1);
2040}
lib/std/zig.zig+2-4
...@@ -667,10 +667,8 @@ pub fn parseTargetQueryOrReportFatalError(...@@ -667,10 +667,8 @@ pub fn parseTargetQueryOrReportFatalError(
667 };667 };
668}668}
669669
670pub fn fatal(comptime format: []const u8, args: anytype) noreturn {670/// Deprecated; see `std.process.fatal`.
671 std.log.err(format, args);671pub const fatal = std.process.fatal;
672 std.process.exit(1);
673}
674672
675/// Collects all the environment variables that Zig could possibly inspect, so673/// Collects all the environment variables that Zig could possibly inspect, so
676/// that we can do reflection on this and print them with `zig env`.674/// that we can do reflection on this and print them with `zig env`.